How can i copy the ordered guide variable to request table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 11:02 AM
Hi,
We have a reference variable on the ordered guide Development which is a reference variable.
I have created a custom field on Request table same as Development which is a reference field same as ordered guide variable.
Now, when a user selects Development from Ordered guide form then after the request creation the variable needs to be copied to Request table Development field.
I have created a BR. But the field is not populating.
How can I achieve this?
Thank you,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2024 10:53 AM - edited 06-09-2024 10:55 AM
Hi @BalaLalitha Gun ,
I tried your problem in my PDI and it works for me please check below script
Please create Before Business Rule and add table name - sc_request also inserte(checked) and below code
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var reqGr = new GlideRecord('sc_req_item');
reqGr.addQuery('request', current.sys_id);
reqGr.query();
while (reqGr.next()) {
gs.log("Inside while Test");
// Get the value of the Development variable from the catalog item
var val = gr.variables.<variable backend Value>;
current.<your_new_field> = "Sarthak - " + val;
gs.log("Inside while Test == " + val);
}
})(current, previous);
Result
I tried to add value in short_description it works for me with above script
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak