Hello,
Please i need your help i am trying to trigger a business process and send a parameter from frontend (Creatio List), the process is running without sending the parameter.
please follow the below information and image:
I created a button to trigger a custom method,
Dependencies:
define("UsrCustomerComplaints_FormPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ {
button:
{
"operation": "insert",
"name": "Button_8jtpbgj",
"values": {
"type": "crt.Button",
"caption": "#ResourceString(Button_8jtpbgj_caption)#",
"color": "primary",
"disabled": false,
"size": "large",
"iconPosition": "only-text",
"visible": true,
"clicked": {
"request": "cfx.clickMeButtonClicked",
"params": {}
},
"clickMode": "default"
},
"parentName": "CardToolsContainer",
"propertyName": "items",
"index": 1
},
handler:
{
request: "cfx.clickMeButtonClicked",
handler: async (request, next) => {
debugger;
const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
type: "crt.RunBusinessProcessRequest",
processName: "UsrComplaintCustomerProcess",
processParameters: {
Id: await request.$context.Id,
NationalID: "Some Value"
},
$context: request.$context
});
if (result.success) {
// process was sucessfully executed
}
}
}
Business process:
and the process log is:
As you can see the ID and NationalID is empty taking into consideration the NationalID is text and ID is Guid type
Please help
Thank you,
Georges
Like
Georges,
Hard to say. I tested and all of my params were received (I tested on 8.1.1 but have similar code running in prior versions without issue).
This worked for me:
const result = await request.$context.executeRequest({ type: "crt.RunBusinessProcessRequest", processName: "UsrProcess_25cd01c", processParameters: { ParamId: await request.$context.Id, ParamText: "Some Value" }, $context: request.$context });
This is executing a process "UsrProcess_25cd01c" from a form page with params named "ParamId" and "ParamText", both params were received in the process.
(Side note, it doesn't matter that mine executes using executeProcess and yours with HandlerChainService, they are the same, executeProcess is just a function for executing via HandlerChainService)
Ryan
Hello,
The code you posted does work (I just tested to be sure), assuming that you've used the correct parameter names. It does look like the Id param in your code is "Id" however, in the process it is "ID" (all upper).
Also, you mentioned this is being run from a list. If you're getting the Id from a record in a list, using "request.$context.Id" is not correct (unless the list is on a form page and you're trying to get the primary data source's Id). You can see this article to see how to get the Id from the selected row and pass to the request handler. https://customerfx.com/article/adding-row-action-menu-items-to-a-creati…
Ryan
Hello Ryan,
The code of "ID" field is "Id", even I removed the ID, I don't need this field so the new code is:
{
request: "cfx.clickMeButtonClicked",
handler: async (request, next) => {
var IDNO;
IDNO=await request.$context.StringAttribute_3isg0z3; //this.get()
if(IDNO == "" || IDNO == null){
Terrasoft.showInformation("Please fill the IDNO field, is empty");
}
else{
debugger;
const handlerChain = sdk.HandlerChainService.instance;
const result = await handlerChain.process({
type: "crt.RunBusinessProcessRequest",
processName: "UsrComplaintCustomerProcess",
processParameters: {
NationalID: "Some Value"
},
$context: request.$context
});
if (result.success) {
return next.handle(request);
}
}
//return next?.handle(request);
}
}
The process runs but without the "NationalID" this field is empty why?
Thank you,
Georges
Georges,
Hard to say. I tested and all of my params were received (I tested on 8.1.1 but have similar code running in prior versions without issue).
This worked for me:
const result = await request.$context.executeRequest({ type: "crt.RunBusinessProcessRequest", processName: "UsrProcess_25cd01c", processParameters: { ParamId: await request.$context.Id, ParamText: "Some Value" }, $context: request.$context });
This is executing a process "UsrProcess_25cd01c" from a form page with params named "ParamId" and "ParamText", both params were received in the process.
(Side note, it doesn't matter that mine executes using executeProcess and yours with HandlerChainService, they are the same, executeProcess is just a function for executing via HandlerChainService)
Ryan