Hi Guys,
I have written a plugin code to set word template
public void SetWordTemplate(IOrganizationService orgService, Entity docTemplate, string entityName, Guid recordId)
{
OrganizationRequest request = new OrganizationRequest("new_SetWordTemplate");
request["Target"] = new EntityReference(entityName, recordId);
request["SelectedTemplate"] = new EntityReference(docTemplate.LogicalName, docTemplate.Id);
var response = orgService.Execute(request);
}
and I am using a javascript function to call this plugin which is given below
function generateWordDocument()
{
Process.callAction("new_SetWordTemplate",
[
{
key: "Target",
type: Process.Type.EntityReference,
value: new Process.EntityReference(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId())
},
{
key: "SelectedTemplate",
type: Process.Type.EntityReference,
value: new Process.EntityReference("documenttemplate", "{974488A7-0A8D-ED11-81AB-000D3AC9C1A6}")
}
],
);
}
But On click of the ribbon button it is not triggering the plugin which is called as action.
It is getting hit on line 1 but no further progress.
I need to attach the document template to notes in the record.
can anyone guide me to fix this issue?