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 !!


%d bloggers like this: