- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 12:42 PM
I am working on a solution to pass variables from one task to the next as it passes down the workflow. This is because the later tasks need information provided by the earlier tasks. I have added the fields below to the bottom of tasks. (u_ip_address, u_printer_model)
Then I wrote the below business rule to copy u_ip_address from our Network task into any tasks that are created from the RITM. However this is not populating. I have some rules written in the exact same way for similar catalog items that all work. however this one will not fill in the IP field.
function onBefore(current, previous) {
//Populate IP Address from network task from Hardware Request
var pc = new GlideRecord('sc_task');
pc.addQuery('request_item.request', current.request_item.request);
pc.addQuery('assignment_group', '287ebd7da9fe198100f92cc8d1d2154e'); //network group
pc.addNotNullQuery('u_ip_address');
pc.query();
if(pc.next()){
current.u_ip_address = pc.u_ip_address;
}
}
Any Assistance would be greatly appreciated!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 06:50 PM
I ended up re-making the Business Rule with identical code and everything began working as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 12:53 PM
Please use current.update() as follows
if(pc.next()){
current.u_ip_address = pc.u_ip_address;
current.update();
}
Thanks
PS: please hit like/helpful...if it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 01:51 PM
Still had the same issue. It came up blank in the new task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 01:10 PM
Try with After insert BR.
- var pc = new GlideRecord('sc_task');
- pc.addQuery('request_item', current.request_item);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 01:56 PM
I changed the BR to be an after insert and it did not work. I would actually want this before insert, as I want the BR to search for the correct task and pull the data as it is inserting the new record.