- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello,
I am creating a catalog item and I need to create a catalog UI Policy and Catalog UI Action based on the variable below:
* Is Terminated User a Manager?
Dropdown List with Two options:
- Yes
- No
UI Action if Yes is selected:
Direct Reports
This should auto populate a list of the manager's direct reports.
I do not know how to set up the UI Policy Action so that a list of the manager's direct reports auto populates. Thank you for any help you can offer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
In this case, you need to set the value using a script. A UI Policy can only perform three actions: make a field Read-only, Mandatory, or Visible. If you want to set or modify a field value, you need to write a script in the Advanced section of the UI Policy.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @DeIvory Gordon , If I understand the requirement correctly then you'd like to show direct report based on user selected in another variable. If so, I think there is no need of UI policy here,. Instead, you can have/create two reference variables that refer to User [sys_user] table and one On Change client script.
- First reference variable should be of type simple and referring to User table
- Second reference variable should be of type Advanced with following configuration:
- Reference qualifier: javascript: 'manager=' + current.variables.<first_variable>;
- Variable attributes: ref_qual_elements=<first_variable>
- Create additional On Change Client Script to clear the value:
function onChange(control, oldValue, newValue, isLoading) {
// Do not run when the form is loading
if (isLoading) {
return;
}
g_form.clearValue('<second_variable>');
}
OR
Alternatively, you can hide the second variable initially and make visible based on the UI policy that you referred to. Also, you can have the Checkbox variable included in the reference qualifier of second variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
where should the manager's direct reportees be auto-populated?
share form screenshots
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader