The error
The Code
Entity entity = (Entity)context.InputParameters["Target"];
EntityReference ownerLookup = (EntityReference)entity.Attributes["parentaccountid"];
Guid accountid = ownerLookup.Id;
can any one help me here?
thanks,that works good
Hi,
I guess your plugin is executed when the opportunity is updated. If this is true, and you don't change the field "parentaccountid", your target will not contain this field. You will need to perform a retrieve:
opportunity = service.retrieve(entity.id, entity.id, new ColumnSet("parentaccountid"))
Guid accounId = opportunity.GetAttributeValue<EntityReference>("parentaccountid").Id;
Target = opportunity
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156