0

我已经编写了一个创建后插件,以便在创建关联的案例操作记录时将案例分配给团队。下面是一段代码:

    Entity caseActionEntity = context.InputParameters["Target"];

    EntityReference team = (EntityReference)caseActionEntity.Attributes["fmc_teamid"];
    EntityReference caseEntity = (EntityReference)caseActionEntity.Attributes["regardingobjectid"];

    AssignRequest request = new AssignRequest
    {
          Assignee = new EntityReference("team", team.Id),
          Target = new EntityReference("incident",caseEntity.Id),
    };
    service.Execute(request);

但它给出了例外,因为一项活动应该只有一个所有者方。服务后。执行(请求);执行。谁能告诉我如何将现有的案例记录分配给团队..?

4

2 回答 2

0

Initially I was thinking along the same lines as Vishnu's answer, but the case already exists as you've stated.

The only other thing I can suggest is see how you go by making it an Async plugin so it happens outside the executing transaction.

于 2012-05-02T23:23:22.653 回答
0

对于创建期间的重新分配,只需在预创建中设置 ownerid。您拥有的代码可以正常更新。

这里的帖子详细解释了这一点

将新所有者分配给预约。“一项活动应该只有一个所有者方”

于 2012-04-27T07:36:59.343 回答