The
one thing that you may not expect is the entity you will actually get passed
within your plugin will not actually be incident (case) but will actually by
Incident Resolution:
IPluginExecutionContext context = localContext.PluginExecutionContext;
Entity
incidentResolution = (Entity)context.InputParameters["IncidentResolution"];
From
this you can get the case to update using a standard retrieve, or your
favourite method..:
Entity incident =
localContext.OrganizationService.Retrieve("incident",
((EntityReference)incidentResolution["incidentid"]).Id, colSet);
You
could also do things like check the properties of the case if you wanted to do
some conditional updates, or go off and set something on the account record (if
you couldn’t do it in a workflow of course) and so on and so on…
Now
update the case, call an Org. Service update (pass in your case entity) and
your case will be updated. Happy days.
Cheers,
Nick
No comments:
Post a Comment