Dynamics 365-Assigning Resource to a task RRS feed

  • Question

  • Hi,

    I am trying to allocate resource to a task in Dynamics 365 programmatically. The code is:

    private static void AssignResourceToTask(XrmServiceContext xrm)
                Guid TaskId = new Guid("40e1f9d7-9e8d-4d18-8d0d-08e8ec6ccb4b");
                Guid ResourceId = new Guid("30cd5482-94d1-e611-80e7-c4346bacbf10");
                Guid ProjectId = new Guid("666609d2-9510-e711-ae87-002713bd9b28");
                var AssignResource = new msdyn_resourceassignment
                    msdyn_resourceassignmentId = Guid.NewGuid(),
                    msdyn_bookableresourceid = new Microsoft.Xrm.Client.CrmEntityReference("bookableresource", ResourceId),
                    msdyn_taskid = new Microsoft.Xrm.Client.CrmEntityReference("msdyn_projecttask", TaskId),
                    msdyn_projectid = new Microsoft.Xrm.Client.CrmEntityReference("msdyn_project", ProjectId)




    But I am unable to assign resource to a task using the above code.

    Thursday, March 30, 2017 5:48 AM