CRM Online, latest version.
I have a scenario where I need to record the fact that an exception has been thrown. In this instance it's to record that a dodgy email has attempted to be entered against the contact. I have the plugin running sync on both create and update of contact.
In my body I'm checking whether the email address matches:
try{ throw new Exception("<h2>Invalid Email Domain</h2>"); } catch (Exception ex) { Entity eRecord = new Entity("test_emailexclusionlog"); eRecord["test_name"] = (string)targetEntity["emailaddress1"]; eRecord["ownerid"] = new EntityReference("systemuser", context.UserId); tracer.Trace("create log record #2"); service.Create(eRecord); throw new InvalidPluginExecutionException(ex.Message); }
but the log record isn't being created.
*This post is locked for comments