Shishir Srivast
Mega Sage

If you are running your Business Rule on sc_task table and I think you should be able to access the field simple by current.<field_name>;


I can see that you are using current for every table, i don't think that's possible, you need to GlideRecord the table and then assign the value to that particular table's field..



example:


(function executeRule(current, previous /*null when async*/) {


    var sc_req_item = new GlideRecord('sc_req_item');


    sc_req_item.get(parent_id);


    var gr = new GlideRecord('sc_task');


    gr.addQuery('parent', sc_req_item.sys_id);


    gr.addQuery('state', '1').addOrCondition('state', '-5');


    gr.query();


    if (gr.next()) {


          if (sc_req_item.stage.changes())


                sc_req_item.update();


    } else {  


          sc_req_item.stage = 'complete';


          sc_req_item.update();


    }


}