Service that runs business processes
ProcessEngineService.svc
is a web service implemented in the Creatio service model to run business processes. Use the web service to integrate external apps with Creatio.
Run a business process from an external app
Use the CreatioURL/0/ServiceModel/ProcessEngineService.svc
URL to access Creatio objects. For example, https://mycreatio.com/0/ServiceModel/ProcessEngineService.svc
.
The Terrasoft.Core.Service.Model.ProcessEngineService
class implements the ProcessEngineService.svc
functionality. View the primary methods of the ProcessEngineService.svc
service in the table below.
Method | Description |
---|---|
Execute() | Runs a business process. Passes a key-value collection of input business process parameters where key is the parameter code (the |
ExecProcElByUId() | Executes a specific business process element. Can only execute an element of a running process. |
View the full list of the methods in the .NET classes reference.
Run a business process from the front-end
Creatio lets you run a business process from the front-end using the following ways:
executeProcess()
method of theProcessModuleUtilities
module in theCrtNUI
packageexecute()
method of theTerrasoft.process.RunProcessRequest
classProcessEngineService
service of the@creatio-devkit/common
library. Available in Creatio 8.2.3 and later. Learn more: Interact with business processes using a request handler.
Run a business process using the executeProcess() method
-
Create the Client module schema type if needed. Instructions: Configuration elements of the Client module type.
-
Add the
ProcessModuleUtilities
module as a dependency to the module of the page that calls the service. -
Implement the
executeProcess()
method. Set theargs
object as a parameter. -
Pass the method parameters listed in the table below.
Parameter
Parameter type
sysProcessName
Name (the
Code
property value) of the business process to run. Optional if thesysProcessId
parameter is used.sysProcessId
The ID of the business process to run. Optional if the
sysProcessName
parameter is used.parameters
Key-value collection of input business process parameters where key is the parameter code (the
Code
property value) and the value is the parameter value. -
Call the
executeProcess()
method.
Run a business process using the execute() method
-
Create the Client module schema type if needed. Instructions: Configuration elements of the Client module type.
-
Create the
RunProcessRequest
class. -
Pass the method parameters and list of output parameters listed in the table below.
Parameter
Parameter type
schemaName
Name (the
Code
property value) of the business process to run.schemaUId
The ID of the business process to run.
parameters
Key-value collection of input business process parameters where key is the parameter code (the
Code
property value) and the value is the parameter value.resultParameterNames
Collection of output business process parameters whose values must be received when executing the process. Pass as an array.
-
Call the
execute()
method.
Run a business process from the back-end
To run a business process from the back-end, call the Execute()
method of the Terrasoft.Core.Process.IProcessExecutor
interface. The IProcessExecutor
interface provides a set of the Execute()
method overloads for solving custom tasks. View the description of the IProcessExecutor
interface in the .NET classes reference.
Creatio forbids running the business process that has output parameters in the background.
Run a business process that passes or receives parameters
View a list of ways to run a business process that passes or receives parameters from the back-end in the table below.
Method | Description | ||
---|---|---|---|
Execute(string processSchemaName) processSchemaName Name (the | Runs a business process using the process name (the | ||
Execute(Guid processSchemaUId) processSchemaUId The ID of the business process to run. | Runs a business process using the process ID. |
View the example that runs a business process using the process name below.
UserConnection userConnection = Get<UserConnection>("UserConnection");
IProcessEngine processEngine = userConnection.ProcessEngine;
IProcessExecutor processExecutor = processEngine.ProcessExecutor;
processExecutor.Execute("UsrProcess2Custom1");
return true;
Run a business process that passes input parameters
View a list of ways to run a business process that passes input parameters from the back-end in the table below.
Method | Description | ||||
---|---|---|---|---|---|
Execute(string processSchemaName, IReadOnlyDictionary<string, string> parameterValues) processSchemaName Name (the parameterValues Key-value collection of input business process parameters where key is the parameter code (the | Runs a business process using the process name (the | ||||
Execute(Guid processSchemaUId, IReadOnlyDictionary<string, string> parameterValues) processSchemaUId The ID of the business process to run. parameterValues Key-value collection of input business process parameters where key is the parameter code (the | Runs a business process using the process ID. |
View the examples that run a business process below.
- Transfer an integer parameter value
- Transfer a parameter value of the value collection type
- Transfer a parameter value of the object collection type with attributes
UserConnection userConnection = Get<UserConnection>("UserConnection");
IProcessEngine processEngine = userConnection.ProcessEngine;
IProcessExecutor processExecutor = processEngine.ProcessExecutor;
var nameValues = new Dictionary<string, string>();
int parameter1Value = 100;
nameValues["parameter1"] = parameter1Value.ToString();
processExecutor.Execute("UsrProcess3Custom1", nameValues);
return true;
UserConnection userConnection = Get<UserConnection>("UserConnection");
IProcessEngine processEngine = userConnection.ProcessEngine;
IProcessExecutor processExecutor = processEngine.ProcessExecutor;
ObjectList<int> values = ObjectList.Create(1, 2, 3, 4);
string serializedValue = BaseSerializableObjectUtilities.SerializeToJson(values);
var parameterNameValues = new Dictionary<string, string>();
parameterNameValues["InputValueList"] = serializedValue;
processExecutor.Execute("ProcessRunsFromScriptTask", parameterNameValues);
return true;
UserConnection userConnection = Get<UserConnection>("UserConnection");
IProcessEngine processEngine = userConnection.ProcessEngine;
IProcessExecutor processExecutor = processEngine.ProcessExecutor;
/* Create an object collection. */
var list = new CompositeObjectList<CompositeObject>();
var item1 = new CompositeObject();
/* The process parameter object includes "Id" and "Name" columns. */
item1["Id"] = new Guid("94cc536a-71a7-4bfb-87ca-13f53b23c28e");
item1["Name"] = "Name1"; list.Add(item1);
var item2 = new CompositeObject(); item2["Id"] = new Guid("e694d36e-1727-4276-9fbf-b9aa193e4f44");
item2["Name"] = "Name2";
list.Add(item2);
string serializedValue = BaseSerializableObjectUtilities.SerializeToJson(list);
var parameterNameValues = new Dictionary<string, string>();
parameterNameValues["InputObjectList"] = serializedValue;
processExecutor.Execute("ProcessRunsFromScriptTask", parameterNameValues);
return true;
Run a business process that receives a single output parameter
View a list of ways to run a business process that receives a single output parameter from the back-end in the table below.
Method | Description | ||||||
---|---|---|---|---|---|---|---|
Execute<TResult>(string processSchemaName, string resultParameterName, IReadOnlyDictionary<string, string> parameterValues) processSchemaName Name (the resultParameterName Name of the output business process parameter. parameterValues Key-value collection of input business process parameters where key is the parameter code (the | Runs a business process using the process name (the | ||||||
Execute<TResult>(Guid processSchemaUId, string resultParameterName, IReadOnlyDictionary<string, string> parameterValues) processSchemaUId The ID of the business process to run. resultParameterName Name of the output business process parameter. parameterValues Key-value collection of input business process parameters where key is the parameter code (the | Runs a business process using the process ID. |
View the examples that run a business process using different ways below.
UserConnection userConnection = GetUserConnection();
IProcessExecutor processExecutor = userConnection.ProcessEngine.ProcessExecutor;
/* Key-value collection of input business process parameters where key is the parameter code (the "Code" property value) and the value is the parameter value. */
var inputParameters = new Dictionary<string, string> {
["SomeInputParameter1"] = "SomeInputParameter1Value",
["SomeInputParameter2"] = "SomeInputParameter2Value"
};
string processSchemaName = "SomeBusinessProcessCode";
Guid processSchemaUId = Guid.Parse("00000000-0000-0000-0000-000000000000");
/* Run a business process using the process name. Returns the text value of the "SomeOutputParameter3" parameter. */
string resultValue = processExecutor.Execute<string>(processSchemaName, "SomeOutputParameter3");
/* Run a business process using the process ID. Returns the text value of the "SomeOutputParameter3" parameter. */
string resultValue = processExecutor.Execute<string>(processSchemaName, "SomeOutputParameter3");
/* Run a business process using the process name and collection of input process parameters. Returns the text value of the "SomeOutputParameter3" parameter. */
string resultValue = processExecutor.Execute<string>(processSchemaName, "SomeOutputParameter3", inputParameters);
/* Run a business process using the process ID and collection of input process parameters. Returns the text value of the "SomeOutputParameter3" parameter. */
string resultValue = processExecutor.Execute<string>(processSchemaUId, "SomeOutputParameter3", inputParameters);
Run a business process that receives a collection of output parameters
View a list of ways to run a business process receives a collection of output parameters from the back-end in the table below.
Method | Description | ||||||
---|---|---|---|---|---|---|---|
Execute<TResult>(string processSchemaName, IEnumerable<string> resultParameterNames, IReadOnlyDictionary<string, string> parameterValues) processSchemaName Name (the resultParameterNames Collection of output business process parameters. parameterValues Key-value collection of input business process parameters where key is the parameter code (the | Runs a business process using the process name (the | ||||||
Execute<TResult>(Guid processSchemaUId, IEnumerable<string> resultParameterNames, IReadOnlyDictionary<string, string> parameterValues) processSchemaUId The ID of the business process to run. resultParameterNames Collection of output business process parameters. parameterValues Key-value collection of input business process parameters where key is the parameter code (the | Runs a business process using the process ID. |
View the examples that run a business process using different ways below.
UserConnection userConnection = GetUserConnection();
IProcessExecutor processExecutor = userConnection.ProcessEngine.ProcessExecutor;
/* Key-value collection of input business process parameters where key is the parameter code (the "Code" property value) and the value is the parameter value.*/
var inputParameters = new Dictionary<string, string> {
["SomeInputParameter1"] = "SomeInputParameter1Value",
["SomeInputParameter2"] = "SomeInputParameter2Value"
};
/* Collection of output business process parameters.*/
var resultParameterNames = new string[] {
"SomeOutputParameter1",
"SomeOutputParameter2"
};
string processSchemaName = "SomeBusinessProcessCode";
Guid processSchemaUId = Guid.Parse("00000000-0000-0000-0000-000000000000");
/* Run a business process using the process name and collection of output process parameters. */
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, resultParameterNames);
/* Run a business process using the process ID and collection of output process parameters. */
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, resultParameterNames);
/* Run a business process using the process name and collections of input and output process parameters. */
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaName, inputParameters, resultParameterNames);
/* Run a business process using the process ID and collections of input and output process parameters. */
ProcessDescriptor processDescriptor = processExecutor.Execute(processSchemaUId, inputParameters, resultParameterNames);
Running a business process that receives a collection of output parameters returns an object of the ProcessDescriptor
type. View the description of the ProcessDescriptor
class in the .NET classes reference.
To receive the values of output parameters, use the ResultParameterValues
property of the IReadOnlyDictionary<string, object>
type in the Terrasoft.Core.Process.ProcessDescriptor
class.
View the example that receives the output parameter values below.
ProcessDescriptor processDescriptor = processExecutor.Execute("processSchemaName", inputParameters, resultParameterNames);
object parameter3Value = processDescriptor.ResultParameterValues["SomeOutputParameter3"];
if (processDescriptor.ResultParameterValues.TryGetValue("SomeOutputParameter4", out object parameter4value)) {
Console.Log(parameter4value);
}
See also
Interact with business processes using a request handler
Resources
Terrasoft.Core.Service.Model.ProcessEngineService class (.NET classes reference)
Terrasoft.Core.Process.IProcessExecutor interface (.NET classes reference)
Terrasoft.Core.Process.ProcessDescriptor class (.NET classes reference)