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.

Prevent record creation in parent table

Darshan8
Tera Expert

Hi All,

 

I have a child and a parent table. A workflow script is supposed to create a record on the child table but it does create the record on the parent table as well. I tried writing a before-business rule on the parent table to prevent the record creation on the parent table but it is also blocking the record creation in the child table. Script below:

 

(function executeRule(current, previous /*null when async*/ ) {
 
    var preventCreation = current.isNewRecord();
 
    if (preventCreation) {
//return false; this statement is still creating the record.
        current.setAbortAction(true);
    }
1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Darshan8 You can't prevent this from happening this is an OOTB behaviour and a parent table will always have record from the child tables. If you try to prevent this by a business rule the record would not get created on the child table at all.

View solution in original post

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Darshan8 You can't prevent this from happening this is an OOTB behaviour and a parent table will always have record from the child tables. If you try to prevent this by a business rule the record would not get created on the child table at all.

Thank you Sandeep!