Page tree
Skip to end of metadata
Go to start of metadata

Beside Frontend Triggers, which have an individual handling, described here, you can also trigger default workflows.

Simple by using this JavaScript code:

var crmId = 881; // CRMID you want to use as main record to execute the workflow
var workflowId = 1; // Workflow ID you want to execute

var execution = new WorkflowExecution();
execution.setCallback(function(response) {
	// result handler, when workflow is executed
    // When you use "javascript response" block, you will get data in response.responsedata
});

execution.init(crmId );
execution.setWorkflowById(workflowId );

execution.execute();

Methods

There are several methods you can use to customize the execution. They are optionally and must be executed before the execute() call.

enableRedirection

execution.enableRedirection(false);

This function enable/disable redirections you use within your workflow. When set to false, the user won't be redirected to any page and page do not reload when workflow is finished.

When workflow send downloads they are still processed.

setBackgroundMode

execution.setBackgroundMode(true);

Per default the workflow is blocking UI during execution AND reload current page when finished. The background mode disable both results.

When workflow send downloads or redirections they are still processed.

setEnvironment

execution.setEnvironment({"var1":"value1"});

Set the environmental variables of the execution to the parameter you set.

  • No labels