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
But if we want to do this for all the Resources, then it is tedious and not practical to ask each resource to create delegate. For example, on of our clients requested that HR should be able to enter Time entry on behalf of any resource in the organization.

I also saw that many organizations need a feature like this. So I thought of creating a console application which will get all the Bookable resources of type User and create Delegations.

Below is the code that you can use to create delegations for all users in the organization.

You can use the same code to create a plugin if you want to automatically create delegate on creation of Bookable resource.

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"));
                    Guid DelegationId = _client.Create(TimeEntryDelegation);
                catch (FaultException<OrganizationServiceFault> ex)
                    Console.WriteLine("Resource: " + bookableResource.GetAttributeValue<string>("name") + " Error: " + ex.Message);




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:

 Image source: Submitting Time Expense entries9Image Source:

The post PSA – Create Time Entry Delegations for all resources appeared first on CloudFronts - Microsoft Dynamics 365 | Power BI | Azure.