0

I'm have written a Post-create plug-in to assign a case to team when associated case action record has created. Below is the piece of code:

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

But its giving exception as There should be only one owner party for an activity. after service.Execute(request); executed. Can any one tell me how to assign existing case record to team..?

Charan Raju C R
  • 758
  • 5
  • 21
  • 43

2 Answers2

0

For reassignment during create simply set the ownerid in pre-create. The code you have will work fine for update.

The post here explains this in detail

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

Community
  • 1
  • 1
  • This plug-in is triggering on create of X-Entity record and set the owner of Y-Entity record to the team present in X-Entity record. I guess it doesn't matter whether its pre-create or post-create or update. And I also tried the link what u given here.. – Charan Raju C R Apr 27 '12 at 07:52
  • Apologize. I misunderstood the problem. Is this a new CRM enironment or was it upgraded from a previous version. – Vishnu Arunachalam Apr 27 '12 at 08:07
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.

Community
  • 1
  • 1
Kias
  • 841
  • 9
  • 22