Can I pass a variable from a requested item to the approval?

cmills_1128
Kilo Contributor

Could I achieve this with a client script?   I created a string field on the approval form, but I need to figure out how to pass the text from the request to the approval form.

The variable on the item is a single line text variable named bms_program_name

The field on the approval is a string field named u_bms_program_name

1 ACCEPTED SOLUTION

Cynthia,



I have skimmed through your comments and noticed that you have only checked insert check-box on the business rule. You will have to check the update check-box too and add this script. It should work now



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



var app = new GlideRecord('sysapproval_approver');


app.addQuery('sysapproval', current.sys_id);


app.query();



while (app.next()) {


        app.u_bms_program_name = current.variables.bms_program_name;


        app.update();


}


})(current, previous);




Thanks,


Abhinay



PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

10 REPLIES 10

Hi Chuck,



Thanks for the help!



Best,


Cynthia