1
votes

I've written a plugin to change or update the value of a lookup field on Merge message. I tried to debug using profiler but I am not able debug it is asking for download log location which I don't have. So I am asking here for your help. Since this plugin is registered on Merge message I am using subordinateId for the guid of the child record and I've used fetch to retrieve the attributes.

EntityCollection ec = service.RetrieveMultiple(new FetchExpression(fetch));
foreach (var item in ec.Entities)
                            {
                                item.Attributes["subordinatedId"] = new EntityReference("task", subordinateId);
                                item.Attributes["new_taskissuephase"] = entityTaskIP;
                                service.Update(item);
}
ExecuteMultipleResponse multipleResponse = (ExecuteMultipleResponse)service.Execute(multipleRequest);

Where did I go wrong in updating the lookup field? Someone please review. Thanks

1

1 Answers

0
votes

I can't see any immediate problem with your code, so we really should get the debug tool working.

It's quite possible it's trying to update the old record (which is probably read only) or that the proper attributes are not being passed through to the plugin. By default only the fields that are changed get passed into the plugin, so it's possible that you will have to perform a lookup before you can update the field with the correct task ID.

Have you installed the plugin profiler? The button will look like this if you have. http://i.imgur.com/OtiXMTS.png

once that's completed, we need to set up your plug in to throw and exception whenever it runs.

Click on the step in question and go "Start Profiling". select exception and press okay.

At this point in time a pop up will come up every time the plugin runs. This is the log file that the plugin registration tool is looking for. If this pop up does not come up, It might mean that there is a problem with the message registration. Merge is a bit of a funny one.

I'd start there, once you have the debug tool working you'll be able to take a look at the variables directly.