Background:
One of the frequent requests we continuously get from our clients is for someone else to do Time entries on behalf of other resources.
We know that this can be done using Delegations feature in Dynamics 365 PSA. You can read more about delegations here written by another D365 PSA Expert – Priyesh Wagh : Delegating Time Entries in D365 PSA
Example:
Sample Code:
You can get the entire code from my Github
#region Create Delegations for all User Bookable Resources to Particular person foreach (Entity bookableResource in userBookableResources.Entities) { Entity TimeEntryDelegation = new Entity("msdyn_delegation"); TimeEntryDelegation["msdyn_delegationfrom"] = new EntityReference("bookableresource", bookableResource.Id); TimeEntryDelegation["msdyn_delegationto"] = new EntityReference("bookableresource", DelegateToId); TimeEntryDelegation["msdyn_startdate"] = new DateTime(2018, 10, 1); TimeEntryDelegation["msdyn_enddate"] = new DateTime(2022, 12, 31); TimeEntryDelegation["msdyn_type"] = new OptionSetValue(192350000); //Time Entry TimeEntryDelegation["msdyn_name"] = string.Format("Delegation to HR for {0}", bookableResource.GetAttributeValue<string>("name")); try { Guid DelegationId = _client.Create(TimeEntryDelegation); } catch (FaultException<OrganizationServiceFault> ex) { Console.WriteLine("Resource: " + bookableResource.GetAttributeValue<string>("name") + " Error: " + ex.Message); } } #endregion
Note:
Please note that the “Delegate to” Resource/ User should also have Delegate role in order to be able to do time entry on behalf of others. If not, then you will face below error:


Is it possibile to do this into the PSA version 3?
LikeLike
Is it possible to use this approach in PSA v3?
LikeLike
Hi Daniela Thanks for the comment and sorry for the delay, It should work but I will review this in V3 and comment here with confirmation.
LikeLike