Assign new owner to appointment. “There should be only one owner party for an activity”

前端 未结 3 1862
别那么骄傲
别那么骄傲 2021-01-13 12:09

I need to change the owner of an appointment record when creating a new appointment. I\'m using a plugin for the create message and i\'ve found this code to assign a new own

3条回答
  •  情歌与酒
    2021-01-13 12:47

    I was doing something similar with tasks (reassigning them in a plugin). As a "Update" plugin it didn't have any problems, but as "Create" it would fail with the message "There should be only one owner party for an activity"

    To fix this change the "Create" plugin to simply set the ownerid (instead of executing the AssignRequest).

    targetEntity.Attributes["ownerid"] = new EntityReference(SystemUser.EntityLogicalName, assignTo.Id);
    

    This code goes in the Pre-operation stage.

提交回复
热议问题