Populating a Variable on sc_req_item table on update of catalog variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 07:46 AM
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!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 08:58 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 09:23 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 07:59 AM
Hi Alex,
I have similar requirement. Did you get a solution to this?