Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Populating a Variable on sc_req_item table on update of catalog variable

AlexC1256158230
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?