- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 06:18 PM
Hi,
I have a catlog item that I want a user to select an applicaiton from a list (cmdb_ci_appl) and based of that I want the approval to be a user set on the application. In my workflow I've set the following approval user activity script but it's just skipping the item when testing.
var answer = [];
var application = new GlideRecord("cmdb_ci_appl");
application.addQuery("u_system_owner",current.variables.u_mw_application_name);
application.query();
if(application.next()){
answer.push(application.u_system_owner);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 06:59 PM - edited 06-03-2025 07:00 PM
Hi @wiganmichae
Try this
answer = [current.variables.u_mw_application_name.u_system_owner]
or
answer = []
answer.push(current.variables.u_mw_application_name.u_system_owner)
OR
answer = []
var application = new GlideRecord("cmdb_ci_appl");
if(application.get(current.variables.u_mw_application_name)){
answer.push(application.u_system_owner);
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 06:42 PM
Hi @wiganmichae ,
is variable u_mw_application_name is a reference field referencing cmdb_ci_appl table?
if yes you just need one line
answer.push(current.variables.u_mw_application_name.u_system_owner)
or
var application = new GlideRecord("cmdb_ci_appl");
if(application.get(current.variables.u_mw_application_name)){
answer.push(application.u_system_owner);
}
else
looks the addQuery that you have use needs to update "instead of "u_system_owner" use the actual field the variable is returning
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 06:54 PM - edited 06-03-2025 06:56 PM
Yes the variable just references the application table with a restriction of only operational systems.
My script was picking a user but not the correct one. I just tried both of the above as the scripts above and neither returned a user and the workflow shows an error.
The field it's looking at is just a reference field to sys_user table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 06:59 PM - edited 06-03-2025 07:00 PM
Hi @wiganmichae
Try this
answer = [current.variables.u_mw_application_name.u_system_owner]
or
answer = []
answer.push(current.variables.u_mw_application_name.u_system_owner)
OR
answer = []
var application = new GlideRecord("cmdb_ci_appl");
if(application.get(current.variables.u_mw_application_name)){
answer.push(application.u_system_owner);
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 07:03 PM
Ok first script just skips but the second seems to have worked as expected on first test.
I will continue to test but looks good at this stage thanks.