The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Populating a Variable on sc_req_item table on update of catalog variable

alexcharleswort
Tera Expert

I have a need to be able to populate a variable located on the request item table (u_tra_amnt) when a catalog variable (tra_amnt_given) is updated from the task level. I know I need a business rule and I have been able to run a couple and successfully populate that variable on submit, but if any changes are made to that variable, it doesn't update. I am using after update functionality, but it's not working.

The script I am using is current.u_tra_amnt = current.variables.tra_amnt_given;

That's a BR on the sc_req_table

Any thoughts??

Thank you all in advance!

17 REPLIES 17

Why to write BR on Request item table when your variable is getting updated on mtom table.


From what I got your requirement, you need to write BR sc_item_option table



BR table- sc_item_option


condition- item_option_new.name==tra_amnt_given&& current.value changes()



script-



var gr = new GlideRecord('sc_item_option_mtom');


gr.addEncodedQuery('sc_item_option.value='+current.value+'^sc_item_option.item_option_new.name=tra_amnt_given');   //double check my encoded query string syntax


gr.query();



if(gr.next()) {


      gr.request_item.u_tra_amnt= current.value;


    gr.update();


}


That didn't seem to work. and I wish I could double check your encoded query but I'll admit, I don't know what the sytax is supposed to be for that. I don't ever use encoded query.


Hi Alex,



I have similar requirement. Did you get a solution to this?