- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:16 AM
Hi all, There is a field which contains five dropdown values. When i select the first value in the dropdown it should pop-up the UI action. In this scenario, I've created a client script but its reflecting error.
UI action
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 04:10 AM
ok , this is intresting for this you need to create a UI POLICY (ADVANCE SCRIPT)... See the below example.
create an UI Policy and change to the advanced view. {example logic given below}
Set the conditions that you normally would have on the UI Action. Make sure the "On load" & "Reverse if false" is checked like this:
And now for the magic to happen. Go into the Script section and check the Run scripts.
Put in the following code and as you can see we are using the action name as an identifier to find the UI Action and then simply using show() & hide() to make the button visible or not depending if the condition is true or not.
EDIT: This picture has been updated:
If you have been doing this in your dev you will now see that your button will hide and show depending if you change the priority to 1 or not.
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:29 AM
Hi @Eswari K getUIAction() is not a function in Servicenow. Plesae refer this Developer Doc https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/client/c_GlideFormAPI#r_GlideFo...
getActionName()
String | The current action name. |
Example
function onSubmit() {
var action = g_form.getActionName();
alert('You pressed ' + action);
}
Regards,
Siddharam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:44 AM
Hi @Eswari K ,
What do you mean by ''POP UP THE UI ACTION'' ? do you mean to say that you wanted to control the visiblity of the UI ACTION based on this fields value ?
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:56 AM
Hi @Sohail Khilji, Thanks for you response
do you mean to say that you wanted to control the visiblity of the UI ACTION based on this fields value ?
Ans: Yes, In a fields there is a five dropdown values, when I select 1st value, then it should show the UI action button. If the user select 2nd value. then it shouldn't show the UI action button.