How to pass "Collection type" Parameter from Code

In this Code "CollectionParameter" is Collection of records type.

 

const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
    type: "crt.RunBusinessProcessRequest",
    processName: "UsrSomeProcess1",
    processParameters: {
      CollectionParameter : //How it should be passed ?
      SomeParameter: "Some Value" //ID Paramete
    },
    $context: request.$context
});
 
if (result.success) {
    // process was sucessfully executed
}

 

 

Like 1

Like

3 comments

Hello!

 

You can use the ProcessEngineService in order to run a business process through a web service and send a collection parameter. The Academy has published an article with a detailed example of how to use ProcessEngineService, which you can find at https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/integrations-and-api/business-process-service/examples/run-the-business-process-web-service

Additionally, there's an overview of the web service that explains how to send a key-value collection of incoming parameters, and you can access it at https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/integrations-and-api/business-process-service/overview

Is this possible yet with the crt.RunBusinessProcessRequest handler? It would be useful functionality.

Harvey Adcock,

I wrote up the details here: https://customerfx.com/article/executing-a-process-and-passing-a-collection-of-records-via-javascript-code-in-creatio/

In short, you form the parameter payload to match the collection param, but the key for using "crt.RunBusinessProcessRequest" is that you have to convert it to a string (using JSON.stringify). That part isn't required if using ProcessModuleUtilities.

Ryan

Show all comments