I have an autolaunched flow that I'm invoking with a rest api call. Here's the sample code that shows how I call my flow from a express.js server.
var _request = {
url: '/services/data/v54.0/actions/custom/flow/FlowName',
method: 'post',
body: JSON.stringify(
{
inputs: [
param1: value1,
param2: value2,
]
}
),
headers : {
"Content-Type" : "application/json"
}
};
const salesforce = config.getProperty('SalesforceRest');
const conn = new sf.Connection({ loginUrl: salesforce.host });
try {
await conn.login(salesforce.userName, salesforce.Password + salesforce.Token);
} catch (error) {
return res.status(500).send(errorResponse.ServerError(`Salesforce login failure: ${error}`));
}
conn.request(_request, function(err, resp) {
console.log(resp);
});
I'd like to know how to set the statusCode and the response message values in my flow. For example to return a statusCode = 400 and message = 'Missing required value' when my flow runs and finds out there's a missing required value. I tried to be clear with my question but please let me know if I need to put more information here.