Update table business rule delete

Nadey
Tera Contributor

I need to update a field in a table only when all the records in another table with a specific field type have been deleted. I am using a Business rule with the "Delete" on when to run. 

my business rule script:

var user = current.u_userid;

var product = current.u_product; <----- need to check this field

var arr[];

 

var  gr = new gliderecord('sys_user');

gr.addquery('sys_id', user);

gr.query();

if(gr.next()){

gr.setvalue('myfield', true);

gr.update();

}

 

Thanks 

5 REPLIES 5

Hi,

please make the BR as before delete.

Try to debug by adding gs.info() statements.

Regards
Ankur

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