- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2014 11:21 AM
Trying to set it up so that if someone updates a variable that is shared between RITM's (as in, shares the same name), it will update all of the variables, on all of the RITM's, of that REQ. The example would be for on-boarding where we have an Order Guide that creates the REQ using Catalog Items and variable sets. If the variable Employee Start Date (emp_start) needs to be updated, HR only has to update it on one Catalog Item and then it could replicate to all of them.
I'm hoping someone has already accomplished this but can't seem to find a discussion. If they haven't, would this be best through a Business Rule that would run through all of the RITM's via the REQ?
Any help would be greatly appreciated.
-Jon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2015 05:45 AM
Jon -- I wrote a script yesterday that got this to work.
Table: sc_req_item
When: After, Update
Condition: current.variable_pool.changes()
updatePeerItems();
function updatePeerItems() {
var req = new GlideRecord('sc_request')
if (req.get(current.request)){
req.description = current_description;
req.update();
}
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.request);
gr.query();
while (gr.next()) {
// names of common variables all start with common...
gr.variable_pool.common_LN = current.variable_pool.common_LN;
gr.variable_pool.common_MI = current.variable_pool.common_MI;
gr.variable_pool.common_FN = current.variable_pool.common_FN;
gr.variable_pool.common_preferred_name = current.variable_pool.common_preferred_name;
gr.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2014 04:02 PM
Hi Jon,
You probably could approach this by using a business rule to copy the variables across. I would propose a possible alternative: store the variables elsewhere in a consistent location for all items.
It is clear that each of these items should share these common variables. So it seems the variables would be better stored separately and referenced by each Req Item. You could accomplish this by copying the variables to the Request record or by creating a separate table for holding New Hire information.
This will alleviate the need to manually maintain the referential integrity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2015 12:33 PM
Hi, Jon
I have this same requirement due to onboarding. Did you end up using a business rule to keep all of the common variables in sync? Thank you
Miriam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2015 09:23 AM
Hi Miriam,
I started down that path but priorities quickly changed. We still have the same problem but have found that rarely does that data change so it hasn't become a priority, yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2015 02:59 PM
Here's a thought for you Jon,
Why not create the field you need on the request table, let's call it "common_variable". Then in the requested item's form, you can display the variable "request.common_variable". Since all RITM's attached to the request record can "see" the common variable, by displaying that variable, all RITM's will display the same value for it. Anyone editing that value in an RITM form would change it for all other RITMs.