in catalog item create multiple ui policy action in servicenow while clicking new button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 09:55 PM
In catalog item create multiple ui policy action in servicenow while clicking single new button

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 09:57 PM
Hi Pradeep,
In ServiceNow, you can create multiple UI policy actions for a catalog item using a single "New" button by creating multiple UI policies and applying them to the catalog item.
Here are the steps to create multiple UI policy actions for a catalog item:
Create a new UI policy for each action you want to perform. For example, if you want to show a field, hide a field, and make a field mandatory, you would create three UI policies.
Configure each UI policy to perform the desired action when its conditions are met. For example, to show a field, set the "Type" field to "Show", and set the condition to the appropriate field and value. Similarly, to hide a field, set the "Type" field to "Hide", and to make a field mandatory, set the "Type" field to "Mandatory".
Once you have created all the UI policies, go to the catalog item for which you want to create multiple UI policy actions.
Click on the "UI Policies" related list and click the "New" button to create a new UI policy.
In the new UI policy form, enter a name for the UI policy and configure the conditions to determine when the UI policy should be applied.
In the "UI Actions" section of the form, click the "Add" button and select the UI policy action you want to apply. Repeat this step for each UI policy action you want to apply.
Save the UI policy.
Now, when a user opens the catalog item, all the UI policy actions that you configured will be applied based on the conditions you set in the UI policies. Note that if multiple UI policies apply to the same field, the last applied policy takes precedence.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:12 PM
can you show any example

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:22 PM
Hi,
To create multiple UI Policy actions in a ServiceNow catalog item using a single button, you can use a Client Script in combination with UI Policies.
Here are the general steps to achieve this:
- Create a catalog item and add the fields you want to show/hide based on the UI Policy actions.
- Create a UI Policy for each action you want to perform on the form.
- For each UI Policy, set the "When to Apply" condition to the desired criteria.
- For each UI Policy, set the "Action" to the desired value (e.g. show, hide, mandatory).
- Create a Client Script that triggers all the UI Policies when a button is clicked.
- Add the Client Script to the catalog item form.
Here is an example Client Script that triggers multiple UI Policies when a button is clicked:
function performMultipleActions() {
// UI Policy 1: Show field 'u_field1'
var policy1 = new GlideUIPolicy('policy1');
policy1.setField('u_field1');
policy1.setVisible(true);
// UI Policy 2: Hide field 'u_field2'
var policy2 = new GlideUIPolicy('policy2');
policy2.setField('u_field2');
policy2.setVisible(false);
// UI Policy 3: Make field 'u_field3' mandatory
var policy3 = new GlideUIPolicy('policy3');
policy3.setField('u_field3');
policy3.setMandatory(true);
// Refresh the form to apply the UI Policy changes
g_form.refresh();
}
In this example, the Client Script performs three UI Policy actions: it shows 'u_field1', hides 'u_field2', and makes 'u_field3' mandatory.
To use this Client Script in your catalog item form, you can add a UI Action button to the form and set the "onclick" property to the function name (e.g. performMultipleActions).
Keep in mind that you will need to modify the script to match the specific UI Policies and fields you want to use in your catalog item form.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2023 06:05 PM
Rahul,
Would I be able to use a single UI Policy with 2 separate UI Policy Actions (one for each variable I need to hide until a certain node in the flow) or would I need a separate UI Policy for each?