- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 04:26 AM
Hi all,
I am trying to populate approvers from a reference field from WRP form through workflow approval user action. We have a reference field 'Business service' on the WRP form. Once the request is logged by the customer, this field will be filled in internally from backend. I have included an approval action in the workflow to populate the 'Business service owners' based on the Business service selected. Below is the script, any guidance would be much appreciated.
PS: Iam not sure if this line is causing the problem 'var bsowner = current.variables.u_business_services;'. When I checked the log it says 'Undefined'
answer = [];
var bsowner = current.variables.u_business_services;
var gr = new GlideRecord('cmdb_ci_service');
gr.addQuery('name', bsowner);
gr.query();
while(gr.next()) {
answer.push(gr.getValue('u_serviceowner_2'));
answer.push(gr.getValue('u_seniorserviceowner_4'));
}
Thanks
Rini
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2025 05:06 AM
A Record Producer only creates a record on the target table, not an RITM, so the workflow must be running on the table of the created record, not sc_req_item. If you have a field on the target table named 'u_business_services' then the approval script would be:
answer = [];
answer.push(current.u_business_services.u_serviceowner_2.toString());
answer.push(current.u_business_services.u_seniorserviceowner_4.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2025 05:06 AM
A Record Producer only creates a record on the target table, not an RITM, so the workflow must be running on the table of the created record, not sc_req_item. If you have a field on the target table named 'u_business_services' then the approval script would be:
answer = [];
answer.push(current.u_business_services.u_serviceowner_2.toString());
answer.push(current.u_business_services.u_seniorserviceowner_4.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2025 02:11 AM
It worked! Thank you so much.