This is article is based on a customer need to display workflow buttons in a an ASP page that handles company records.

Below you can see that I have created a partial rebuild of the company summary screen.

Since this example is based on the Company Summary screen there are a few steps that must be completed before any code is carried out.

  1. Make sure that you have workflow enabled for the Company Entity.
  2. Make sure the workflow for the company is activated.

The code is quite straight forward.

Note:  I have only written below the core code of the page.  I hope the comments in the code are self-explanatory.  The important thing to realise is that Workflow buttons can only be added to a screen (entrygroup) block that has been deliberately 'executed' with the record passed into the execute method.  


//Block Create
var myCompanyBlock = CRM.GetBlock("companyboxlong");
Title = CRM.GetTrans("Tabnames","company");
//Workflow Properties - Edit View
//Set Block to use workflow properties
//This will only work when entrygroup block uses record object as execute method parameter.
if (CRM.Mode != Edit)
//Buttons only shown in View mode
WorkflowTable = "Company";
//show the "new" buttons for workflow.
ShowWorkflowButtons = true;

var myPersonBlock = CRM.GetBlock("personboxshort");
Title = CRM.GetTrans("Tabnames","person");
DisplayForm = false;
DisplayButton(Button_Default) = false;

//Get Context Info
var intRecordId = CRM.GetContextInfo("company","comp_companyid");
//Record Find using ContextInfo
//Retrieve Record
var myRecord = CRM.FindRecord("company,vsummarycompany","comp_companyid="+intRecordId);

//Block to Web - Preferred
//Arg is either Argument (whereclause) or Record object depending on block type used.
//Remove Arg if no parameter is being passed.
if (CRM.Mode != Edit)

//use default tab group - ensure any CRM.GetTabs() is commented out
//specify a tab group