Show UI action based on the URL parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 09:40 PM
I have a table name "A" on which I have an UI action "X". I want to show this UI action only in one particular module, i.e., when User clicks on that module in the navigator, the URL should be "https://xxxxxxx.service-now.com/x_scoped_app_list.do?sysparm_userpref_module=5b0fb84447de35502bb635a..."
Background: when user clicks on this, it will open one catalog item on portal.
I have conditions like below:
(gs.hasRole("x_scoped_app.manager") && !(RP.getParameterValue('sysparm_view') == 'sys_ref_list')) && (!(RP.isRelatedList())) && (gs.action.getGlideURI().getMap().get('sysparm_userpref_module') == '5b0fb84447de35502bb635a2e36d4312');
But this is not working, any suggestions on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 11:06 PM
Hi @Naga Ravindra R ,
Try the code given below:
if(gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI().indexOf('<string_to_search>') != -1)
The code above will check for the value you will be giving inside the indexOf function in the current URL.
Kindly mark it helpful and correct if it helps resolving your requirement!
Shivam Jaiswal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2024 01:43 AM
Hi @Naga Ravindra R ,
Did you get a chance to try this one?
Kindly mark my response helpful and correct if it helps resolving your requirement.
Shivam Jaiswal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2024 01:16 AM
I have added the following condition:
gs.hasRole("x_scopedd_manger_role") && !(RP.getParameterValue('sysparm_view') == 'sys_ref_list') && RP.getParameterValue("sysparm_userpref_module") == '5b0fb84447de35502bb635a2e36d4312'
UI action is working fine, but when I clicked on UI action it is not working.
Below is my code in my UI action:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2024 07:01 AM
Hi @Naga Ravindra R ,
Please try the below code line:
Please hit the like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.
Thanks & Regards
Jyoti Jadhav