RemoteCommand in HTML web resource. RRS feed

  • Question

  • Hi, 

    I have the following Jscript to initiate an Email template and it is working perfectly when I use the code inside a Jscript web resource.

    var command = new RemoteCommand("EmailTemplateService", "GetInstantiatedEmailTemplate");
    command.SetParameter("templateId", 'a7e5aea9-eb83-e111-9474-005056a9025c');  // Global templateid
    command.SetParameter("objectId", '6BB17557-4654-E011-8A59-005056A10010'); // accountid
    command.SetParameter("objectTypeCode", '1'); 
    var result = command.Execute();

    BUT when i use the same code into a HTML web resources, it prompt me a generate Error msg:-
    LOCID_REMOTECOMMAND_ERROR = 'An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization\x27s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.';
    <HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD runat="server"><TITLE></TITLE>
    <SCRIPT type=text/javascript>
    var ORG_UNIQUE_NAME = '<orgUniqueName>';
    var _sWebServicesNamespace = 'http\x3a\x2f\x2fschemas.microsoft.com\x2fcrm\x2f2009\x2fWebServices';  
    var _aWrpcTokens = [];
    <SCRIPT src="/_common/Global.ashx"></SCRIPT>
    <SCRIPT type=text/javascript>
    	var command = new RemoteCommand("EmailTemplateService", "GetInstantiatedEmailTemplate");
    	command.SetParameter("templateId", 'a7e5aea9-eb83-e111-9474-005056a9025c');  //Global templateid
    	command.SetParameter("objectId", '6BB17557-4654-E011-8A59-005056A10010'); //accountid
    	command.SetParameter("objectTypeCode", '1'); 
    	var result = command.Execute();  //hit error @here
    <META charset=utf-8></HEAD>
    <BODY onload=Get(); contentEditable=true></BODY></HTML>

    Can anyone give some idea? Thanks
    Wednesday, June 6, 2012 9:02 AM