c# - CRM 2013 Updating a incident field during the Close Message -


i trying update particular field when case closed. have plugin registered pre operation event on close message. registered event below.

base.registeredevents.add(new tuple<int, string, string, action<localplugincontext>>(20, "close", "incident", new action<localplugincontext>(executeprecaseclosefolder))); 

and, within execute method, have following code

entity incidentresolution = (context.inputparameters != null && context.inputparameters.contains("incidentresolution")) ? (entity)context.inputparameters["incidentresolution"] : null;  incident incident = (localcontext.organizationservice.retrieve("incident", ((entityreference)incidentresolution["incidentid"]).id, new microsoft.xrm.sdk.query.columnset(true))).toentity<incident>();  string documentseturl = closecase(incident); incident.new_documentseturl = documentseturl; 

however, not updating field. plugin gets triggered when close case , able debug , see updated documentseturl being applied incident.new_documentseturl.

so, why not updating.

if not wrong, pre-operation after validation completed before values being saved. and, updating value before being saved. not correct in understanding?

you can't update incident when closed. have update case before incidentresolution has been created.

in plugin, have update case retrieved: service.update(incident);. ensure case updated before creation of incident resolution.

take @ http://nickhollis.blogspot.pt/2013/04/crm-2011-plugin-to-update-case-incident.html.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -