Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

"Operation against file 'problem' was aborted by Business Rule 'Transform synchronously^<sys_id>'. Business Rule Stack:Transform synchronously"

Alamelu1
Tera Contributor

Im trying to update the state of the problem record through an import set API transform script. I get an error

"Operation against file 'problem' was aborted by Business Rule 'Transform synchronously^<sys_id>'. Business Rule Stack:Transform synchronously"

How to resolve this?

30 REPLIES 30

Hi,

do you have onafter transform script which sets the value; if business rule is disabled then that BR should not trigger

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

It is an 'On Before' Transform script which sets the value.

Hi,

so onBefore sets the state value and Run business rule is disabled;

in your onBefore anywhere you are querying target record and updating it?

Can you share the script here?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I am just trying to parse the incoming payload and based on certain conditions, im updating the state and closed_notes in the target record

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {


try {
gs.info("Target record: " + target.sys_id);


var parser = new global.JSON();
var parsed = parser.decode(source.u_event_details);
gs.info("Sys_id" + source.u_snow_id);


if (parsed && Object.keys(parsed).length > 0) {

if (parsed.workflowIndicator == 'Problem') {
var state = parsed.issueDetails["Issue Status"];

if (state === 'ignored') {

target.state = 107;
target.close_notes += 'Event ignored in Source system';
} else if (state === 'resolved') {

target.state = 107;
target.close_notes += 'Event resolved in Source system';
}
}
}


} catch (ex) {
var message = ex.getMessage();
}

})(source, map, log, target);

Hi,


I would suggest to use field map script. because i think in onBefore script you are trying to update the record and BR is trigger when you try to update the state field.

I can give you 2 advice

1) use setWorkflow(false) in that script

2) use field map script and set value there.


Thanks,
Ashutosh