Please check below screen shot of Account. You can simply check this with OwnerIdType, yet you can’t retrieve that field for some reason.
In fact, I tried below approach which worked for me.
String OwningEntityType = String.Empty; if (_account.OwningTeam != null) { OwningEntityType = "team"; } else { OwningEntityType = "systemuser"; } AssignRequest assignAcc = new AssignRequest { Assignee = new EntityReference(OwningEntityType, _account.OwnerId.Id), Target = new EntityReference(<Target Entity Name>, <Target Entity Name ID>) }; organizationService.Execute(assignAcc);
Could you please share what is _account in the above code. Is it an entity or entityreference?
ReplyDeleteHi Preksha,
ReplyDeleteAccount is an object of type Account, instantiated as below;
Account _account = new Account();