Get sysparm value from URL in a list control
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 12:35 AM
I have a list control for that I want to customize so if a specific sysparm(sysparm_nonew) appears in the url, I want to hide the new button.
But I can't find how get get the sysparm_nonew from the url. I tried "gs.action.getGlideURI().getMap().get('sysparm_nonew')" but will only return null no matter if I got sysparm_nonew=true eller not in the URL.
Any ideas?
//Göran
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 04:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2017 03:26 AM
Hi Goran,
How about this(client script)
var gURL = new GlideURL();
gURL.setFromCurrent();
var triggerConflictDetection = gURL.getParam("sysparm_userpref_module");// you can use your required sysparm
Regards,
Swati
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2017 04:51 AM
Well, it's server side script and I need to put it in the list control field "omit new condition".
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2017 05:05 AM
Hello Göran,
I actually found an OOB List Control record in place for User Role [sys_user_has_role] which has an "omit new condition" which does similar thing by hiding New button given a specific view parameter.
Omit new condition:
RP.getParameterValue("sysparm_view") == "viewname";
That may be present in your instance:
This concept you can potentially use in your scenario, either by passing along your own sysparm_parameter with a value or may consider spinning up a UI view for your list and disable "New" based on that (where "view rules" can also come handy).
I hope this helps.
Best regards,
Andras
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2017 06:03 AM
Just one addition to my post above,
based on my observation the "omit new condition" field, even if it evaluates to true, only hides the UI action in case the button's condition field contains the proper condition checks, for example: !RP.getListControl().isOmitNewButton()
On incident table for example omit new condition did not work with a New button, where its condition field checked for !RP.getListControl().isOmitNewButtonWithoutChecks() which resulted in not hiding that new button even if List Control's "Omit new condition" evaluated to true, only when "Omit new button checkbox" was ticked.