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.
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);
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