My client wanted to have a button that starts a specific workflow on the form. So after analyzing some javascript I ended with this code:
var a = new Array(crmFormSubmit.crmFormSubmitId.value);
var sIds = crmFormSubmit.crmFormSubmitId.value+";";
var sEntityTypeCode = "10004"; //Replace this with your entity type code
var sWorkflowId = "{BE7E47C0-2452-4F44-8CCA-425B83A7A8FB}"; //Replace this with your actual workflow ID
var iWindowPosX = 500; //Modal dialog position X
var iWindowPosY = 200; //Modal dialog position Y
var oResult = openStdDlg(prependOrgName("/_grid/cmds/dlg_runworkflow.aspx")+"?iObjType=" + CrmEncodeDecode.CrmUrlEncode(sEntityTypeCode) + "&iTotal=" +
CrmEncodeDecode.CrmUrlEncode(a.length) + "&wfId=" + CrmEncodeDecode.CrmUrlEncode(sWorkflowId)+ "&sIds=" + CrmEncodeDecode.CrmUrlEncode(sIds) , a, iWindowPosX, iWindowPosY);
Of course this is not supported by Microsoft. You use it at your own risk.
July 2, 2008
Subscribe to:
Posts (Atom)