Retrieve Resources from Resource Group and Service entity programmatically

By | April 6, 2016


In order to deliver a service, resources which represent tools, rooms, people or pieces of equipment are used. These resources are collected into resource groups which have similar attributes. In MS Dynamics CRM, the resources are categorized as Facilities / Equipment or Users.

Recently, we had to retrieve Resources from the Resource Group and Service Entity. Initially, we thought that there was a direct relationship between Resources and Resource Group / Service entity. But we could not find the relationship. So we had to do the task through a program.

Let’s take a look how the resource is retrieved from the resource group.

In MS Dynamics CRM, the resources of Resource Group are stored in the ‘constraints’ field in the form of XML format in Resource Group entity. So, with the help of the code as below we can get the resources from the ‘constraints’ field.

Now, let’s take a look how to retrieve the resource from the service entity.

When we create a service record in the CRM, the MSCRM automatically creates ‘resourcespec’ entity record which has 1:N relationship between the ‘ResourceSpec’ and Service entity. The Dynamics CRM also creates Resource Group entity record which has 1:N relationship between Resource Group and ResourceSpec entity.

So, using the Resource Group entity record we can get the Resources of the particular service.

The code as below is written for retrieving the Resource Group. Next, follow the code as mentioned above to retrieve the resource from the resource group.



Before we end this blog, we hope that the code snippets would help you retrieve the resources.

You may also like to see : Click2Clone – a productivity add-on for Microsoft Dynamics CRM.

Leave a Reply

Your email address will not be published. Required fields are marked *