New Case/ Opportunity Action and Workflow Activation in Sage CRM

By | June 2, 2011

In Sage CRM, we can handle Sales and Service business flow very efficiently. To manage sales in CRM we use Leads and Opportunities whereas for managing services we use cases.

To deal with the cases and opportunities flow; CRM has provided feature of workflow and that’s get activated in CRM automatically once Case/ Opportunity gets created. Now in CRM we can create cases and opportunities at Company and Person level. When we create cases or opportunities the workflow for the same gets activated by default by the system. But have you ever been thought about if someone would like to create a new case/ opportunity using custom page or the dot net dll method anywhere in CRM.

We will simply:

Check what is the action used by the CRM for new case or opportunity. For new case it is 1192 and for Opportunity it’s 1190.

You will prepare an URL at server side.

And then will set the same URL on the button click.

If you just make use of the action while preparing the URL you will face the below problems:

If you are using workflow in your CRM system then that would not be get activated.

To set the default values like Company or Person, the URL should contain other keys like Key0, Key1 and Key2 etc. This would ensure that the primary values would get set correctly.

Now to avoid above issues you will have to arrange the URL to be used on button click.

To activate workflow on the new case action is a standard functionality. But if you observe the standard new case url then you will come to know that it consist of some important parameters related to workflow (e.g. Key27 and trid). And if we just redirect to URL(“1192”) or URL(“1190”) on click of a button CRM does not recognize whether the workflow activated or not. So CRM shows the normal case/opportunity entry screen without considering workflow.

The parameters needed in the URL to activate case workflow for New Cases are Key27=40 and trid=340 paramets where that for opportuntities are Key27=50 and trid=309

For New Case button, your URL would be something like:

string sNewCaseURL = Url(“1192”);

string[] sCaseURLArr;

char[] cSplit = { ‘&’ };

sCaseURLArr = sNewCaseURL.Split(cSplit);

sNewCaseURL = sCaseURLArr[0] + “&Act=1192&Mode=1&CLk=T&Key27=40&trid=340&newbtn=t&T=New&Key0=7&Key7=”;

sNewCaseURL += Dispatch.QueryField(“Key7”) + “&Key1=” + Dispatch.QueryField(“Key1”) + “&Key2=” + Dispatch.QueryField(“Key2”);

AddUrlButton(“New Case”, “newcase.gif”, sNewCaseURL);

For New Opportunity button, your URL would be something like:

string sNewOppoURL = Url(“1190”);

string[] sOppoURLArr;

char[] cSplit = { ‘&’ };

sOppoURLArr = sNewOppoURL.Split(cSplit);

sNewOppoURL = sOppoURLArr[0] + “&Act=1190&Mode=1&CLk=T&Key27=50&trid=309&newbtn=t&T=New&Key0=8&Key8=”;

sNewOppoURL += Dispatch.QueryField(“Key8”) + “&Key1=” + Dispatch.QueryField(“Key1”) + “&Key2=” + Dispatch.QueryFi
eld(“Key2”);

AddUrlButton(“New Opportunity”, “NewOpportunity.gif”, sNewOppoURL);


If you find this content useful, please drop us an email at crm@greytrix.com.