Flow is not triggering from before business rule

abed123
Tera Contributor

Hi Team,
I need to call subflow in before business rule , the business rule is triggering but the subflow is not calling. Could anyone please help on this.

Thanks in Advance!

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@abed123 Could you please post the code here which you are using to trigger the subflow? Also, do you see any error in system logs?

Hi Sandeep,
Thank you for the reply. Please find the below code

var inputs = {};
inputs['input1'] = current.getUniqueValue().toString();
inputs['input2'] = previous.fieldName.toString();
inputs['input3'] = current.fieldName.toString();
sn_fd.FlowAPI.getRunner().subflow('flowName').inBackground().withInputs(inputs).run();
Note: In the name of fieldName that is internal field name.

Thanks

Appanna M
Tera Guru

Hello @abed123 ,

 

The syntax looks good. But Can you check the below once. 

It's possible that previous obj is null, especially when the record is newly created. You should check if previous obj exists before accessing its fields.
Similarly, you should verify that both previous and current records have the "fieldName" field before attempting to access it.

And also add exception handling for better debugging the issue.

try{
var inputs = {};
inputs['input1'] = current.getUniqueValue().toString();
inputs['input2'] = previous.fieldName.toString();
inputs['input3'] = current.fieldName.toString();
sn_fd.FlowAPI.getRunner().subflow('flowName').inBackground().withInputs(inputs).run();
} catch(Err){
	gs.info("Error:"+Err);
}

 

Please Mark My Answer as Helpful and Accept as Solution, if you find this article helpful or resolves your issue.