Starting a Workflow Process from a Custom Toolbar

The following procedure guides you through one example of starting a Workflow Process from a custom toolbar. In this example, a new button is added to the Toolbar and the Workflow Process starts when the button is clicked.

To start a Workflow Process from a custom toolbar

  1. (Optional) Display the Command object type and the Toolbars object type in the Object Explorer.

  2. Navigate to the Business Services list and create a new business service with the values shown in the following table.

    Property

    Value

    Name

    TestTBItem

    Server Enabled

    TRUE

  3. Navigate to the Commands list and create a new command with the values shown in the following table.

    Property

    Value

    Name

    TestTBItem

    Business Service

    TestTBItem

    Method

    TestTBItem

    Target

    Server

  4. In the Object Explorer, click Toolbar, and then query the Name property in the Toolbars list for the following value:

    HIMain
  5. In the Object Explorer, expand the Toolbar object and click Toolbar Item.

  6. In the Toolbar Items list, create a new record with the values shown in the following table.

    Property Value

    Name

    TestTBItem

    Command

    TestTBItem

    DisplayName

    TestTB Item

    Type

    Button

    HTML Type

    Button

    Position

    20

  7. In the Siebel client, define a Workflow Process and make sure it can run successfully from the Process Simulator.

    For more information, see Process of Testing a Workflow Process.

  8. Add the following server script to the business service that you defined in step 2 (TestTBItem). You must use the name of the Workflow Process that you specified in step 7:

    function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
    {
    	var returnValue = ContinueOperation;
    	if (MethodName == "TestTBItem")
    	{
    		CanInvoke = "TRUE";
    		returnValue = CancelOperation;
    	}
    	return (returnValue);
    }
    
    function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
    {
    	var returnValue = ContinueOperation;
    	if (MethodName == "TestTBIItem")
    	{
    	try {
    		var psInput = TheApplication().NewPropertySet();
    		var psOutput = TheApplication().NewPropertySet();
    		var svc = TheApplication().GetService("Workflow Process Manager");
    		psInput.SetProperty("ProcessName", "<WF Process Name Created Above>");
    		svc.InvokeMethod("Run Process", psInput, psOutput);
    		returnValue = CancelOperation;
    	} // end try
    	finally {
    		svc = null;
    		psOutput = null;
    		psInput = null;
    	} // end finally
    	} // end if
    	return(returnValue);
    }
  9. Test your changes using a Siebel Client Application Object Manager.

    Make sure Siebel CRM displays the new button in the toolbar. Click it to make sure the correct Workflow Process starts.