- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 09:10 AM
I need to map variables of catalog item into sc_req_item fields.
Requested for --> u_requested (reference to sys_user)
Location --> location
sc_category --> u_category_task
Watch list --> watch_list
Technician name --> work_notes_list
Estimated end --> estimated_delivery
Equipment --> cmdb_ci, configuration_item
For this I'm using after insert business rule, but I couldn't achieve it. Here is the BR:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 10:01 AM - edited 09-18-2024 10:04 AM
The Filter Condition should be fine. Reference qualifiers don't matter when setting values via script. I can see that the Request for variable is a reference type, but is the u_requested field also a reference type? This is what has to match on each variable and field - so that you're not trying to populate a string value from a variable in a reference type field, etc. To confirm this script is running and the variable values, these are the types of logs I was recommending, and removing the current.update() when switching the BR to before insert. This will help narrow down if there is a conflict between variable type and field type:
(function executeRule(current, previous /*null when async*/) {
gs.info('BR RITM running ' + current.number);
gs.info('BR variable values ' + current.variables.requested_for + ' | ' + current.variables.location + ' | ' + current.variables.sc_category);
current.u_requested = current.variables.requested_for;
if (current.variables.location) {
current.location = current.variables.location;
}
if (current.variables.sc_category) {
current.u_category_task = current.variables.sc_category;
}
if (current.variables.watch_list) {
current.watch_list = current.variables.watch_list;
}
if (current.variables.technician_name) {
current.work_notes_list = current.variables.technician_name;
}
if (current.variables.estimated_end) {
current.estimated_delivery = current.variables.estimated_end;
}
if (current.variables.equipment) {
current.cmdb_ci = current.variables.equipment;
current.configuration_item = current.variables.equipment;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 09:52 AM
No luck.
FYI