Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Exception Calling InstantiateTemplateRequest From a Plugin

$
0
0

Hi,

I am getting a strange error when trying to execute an InstantiateTemplateRequest SDK message inside a plugin.

The call is fairly simple and you expect the Response to contain the e-mail activity created with that template.

InstantiateTemplateRequest instTemplate = newInstantiateTemplateRequest();

instTemplate.TemplateId = templatedId;

instTemplate.ObjectId = relatedtoEntityRef.Id;

instTemplate.ObjectType = relatedtoEntityRef.LogicalName;

InstantiateTemplateResponse instTemplateResponse = (InstantiateTemplateResponse)service.Execute(instTemplate);

When calling the service.Execute() an exception is thrown by CRM.

The root error seems to be:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Crm.ObjectModel.TemplateXmlCreatorContact.GetContactXmlAndAddress()

If I try to manually create an e-mail activity through the front-end, I also get a similar error.

Interestingly, it only seems to occur for certain contacts (as others work ok).

This would point to it being data related but I have no idea what could cause this kind of failure.

Has anyone else ever seen this before?

I can post/provide the server trace logs if needed.

Regards,

Shaun Harvey


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>