Calling EXE or Executing command from CRM 2011 Ribbon button

I had a requirement to execute command or call exe file from CRM Ribbon button which open SAP GUI shortcut based on some parameter which we need to pass as  parameter  from CRM Entity Form. We had written the following function which was called from CRM button.

function CallSAPGUI(l_SAPID)
    var l_c_ConvertToCharCode = String.fromCharCode(34);
var obj_ActiveX = new ActiveXObject(‘WScript.Shell’);

l_s_CommendText = ‘start sapshcut.exe’ + ‘ -user=’ + l_c_ConvertToCharCode + l_SAPID + l_c_ConvertToCharCode + ‘ -client=017’ + ‘ -language=EN’ + ‘ -system=ABC’ + ‘ -gui=/M/vhdh08.ct056.tss.loc/S/3600/G/ct_01’ + ‘ -command=*/TTC/ZZ_PP_RAT_TA3/CLA/ZZ_PP_TARHD-NUM=1000-34;’ + ‘ –maxgui’;

 if (obj_ActiveX)
obj_ActiveX.Run(‘cmd.exe /c ‘ + l_c_ConvertToCharCode + l_s_CommendText + l_c_ConvertToCharCode);

We were using this code in CRM 2011 outlook client. Once I deployed this code , I thought this code will work but I got the below error.

Automation server can’t create object

I visited various blog and found that we need to do the following setting in IE. We need to do the below setting for both “Local Intranet ” and” Trusted Sites ” of Security Tab. Once i did the browser setting SAP GUI was working fine on button click.


Hope it will help you !!


Author: Arvind Singh

Solution Architect with 15+ years of exp. Dynamics CRM, Power Platform, Azure which includes Solution, Design, Development, Deployment, Maintenance and support experience.

One thought on “”

  1. We have similar requirement with SAP, except ours was a lot easier because our client have the web gui for sap. So just have to figure out the url and do a


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: