Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Assign resource for task

(0) ShareShare
ReportReport
Posted on by


Good afternoon. There is a native Custom Action, called Project Task - AssignResourceForTask. I need to call this action on a plugin, in the update of a given field. The action entries are as follows:    

var var1 = localContext.PluginExecutionContext.InputParameters ["Context"];

   var var2 = localContext.PluginExecutionContext.InputParameters ["TeamCollection"];

   var var3 = localContext.PluginExecutionContext.InputParameters ["Target"];

    The purpose is to assign a resource to the task ... Could you help me with inputs?  I'm having trouble understanding what this "TeamCollection" is.  I apologize for the language because I am using a translator.

  • Suggested answer
    Piotr Albertin Profile Picture
    on at
    RE: Assign resource for task

    I know that is quite an old post, but maybe someone else would benefit from an answer. I've been facing a similar challenge few days ago. 

    The TeamCollection is of type EntityCollection and the action expects a list of entities of type Project Team Members (msdyn_projectteam). If the Resource (bookableresource) is not yet a team member for a project you have to create it. 

    Very simple code to call Project Task - AssignResourceForTask (msdyn_AssignResourcesForTask):

    var assignResourcesForTaskReq = new OrganizationRequest("msdyn_AssignResourcesForTask");
    assignResourcesForTaskReq.Parameters["Context"] = null; //is not actually required
    assignResourcesForTaskReq.Parameters["TeamCollection"] = new EntityCollection(
        new List
        {
            new Entity("msdyn_projectteam", teamMemberId)
        });
    assignResourcesForTaskReq.Parameters["Target"] = new EntityReference("msdyn_projecttask", taskId);
    
    crmService.Execute(assignResourcesForTaskReq);

  • Johnny Gong Profile Picture
    6,482 Moderator on at
    RE: Assign resource for task

    Hi IWant,

    I cannot find the specified filed regarding ''TeamCollection". While I found the following DOC on "Booking resource as a team member and then assigning the resource to task".

    I think you could directly try to input the project team to this filed for resource assignment which demos adding resource to the project team first and then assign the resource to tasks in the project schedule.

    docs.microsoft.com/.../faq-assign-resources-to-tasks

    Hope the above would help.

    Regards

    Johnny

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans