In a previous article I outlined how to start or execute a process from client-side code on a classic Creatio page. This article will show you how to start a process from code on a Freedom UI page. Like most things in a Freedom UI page, we’ll start the process by using the HandlerChainService to initiate a crt.RunBusinessProcessRequest request. The HandlerChainService is a part of the Creatio DevKit SDK.
To use the devkit, you’ll need to add “@creatio-devkit/common” to the modules list of your page. This will look like this (note the “@creatio-devkit/common” in the square brackets and the sdk without quotes in the parenthesis):
define("UsrMyCustomEntity_FormPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"] /**SCHEMA_DEPS*/,
function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ {
return {
// ... the rest of the page here
};
});
Now, with that module available, you can access things in the SDK, such as the HandlerChainService class. We’ll get an instance of the HandlerChainService, then execute the request, passing the process name (code) and can also include any parameters we need to pass into the process. Let’s take a look at the code below:
const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
type: "crt.RunBusinessProcessRequest",
processName: "UsrSomeProcess",
processParameters: {
AccountId: await request.$context.Id,
SomeParameter: "Some Value"
},
$context: request.$context
});
if (result.success) {
// process was sucessfully executed
}
In the code above, we’re executing the process named “UsrSomeProcess”. This process has two parameters we’re passing into it (1) AccountId, which we’re populating from the Id on the page, and (2) a param named “SomeParameter”. It is executed and the result will tell us if it was started successfully.




Hey Ryan.
Do you know if it is possible to get the resultParameterValues from the result?
It is not currently possible. The request does not provide back any params from the process. You could send them back to the UI in a message. I also have an article on that topic.
Ryan
For sending a message with any needed params back to the UI from the process:
https://customerfx.com/article/receiving-server-side-messages-in-a-creatio-freedom-ui-page/
Hey Ryan. Maybe I’m barking up the wrong tree here completely…
I am playing with an Angular Component, my plan was to use a Business Process to perform validation (a little more than a regex test), I was initially going to call a web service to do validation, but thought maybe the BP would be an easier way to manage the rules.
Do you have any ideas how I could achieve this using a Business Process?
I could call the BP from the web service…
Hi Gary,
Yes, the only option is to create a configuration service and then call the service from C# code there. When executing a process via C# code, it *is* possible to get back the process params, so you could then return them from the service to the UI.
Ryan
Hi Ryan.
I know this post is kind of old, but I ran into some issues and I pretty much exhausted other options, so in case you see this, here goes:
This code works if I send a Guid as a parameter to the business process:
const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
type: “crt.RunBusinessProcessRequest”,
processName: “QsProcess_Attach_files_to_the_email”,
processParameters: {
RecordIdParameter: “257b4c3f-949c-4b4c-bef9-30575da439d8”
},
$context: request.$context
});
However, if I try to send a text parameter, it always comes out null inside the logs, as well as when debugging, no matter what I try:
const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
type: “crt.RunBusinessProcessRequest”,
processName: “QsProcess_Attach_files_to_the_email”,
processParameters: {
TestStrParameter: “test”
},
$context: request.$context
});
I can confirm both the names specified in the business process and the client module code for the parameter are correct, so no typo involved as far as I can see.
Thanks in advance for your help, love the articles!
Thanks,
Laurentiu
Hi Ryan.
Know it is old post but still want to check whether this works. I have tried with a form which does not have any data source attached and passing a value — it does not work (similar to Laurentiu try)
Please suggest some means to pass UI Parameter value to Process (other than GUID)
Thanks and Regards
Yes, this still works, even for non Guid params. See my response here: https://customerfx.com/article/starting-a-process-from-client-side-code-on-a-creatio-freedom-ui-page-and-getting-back-outgoing-process-parameters/#comment-39615