Get sysparm value from URL in a list control

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

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

23 REPLIES 23

weird.. I tried it, and just to be sure I tested again.. but I get "org.mozilla.javascript.EcmaError: "RP" is not defined." when I put it a log to see what I get...


hmm...strange, I wonder if in your instance RP is still used in OOB records, especially "New" UI action's condition based on which the button gets hidden?



Anyway your first setup gs.action.getGlideURI().getMap().get('sysparm_nonew') should work - I also added .toString() to the end but in any way


it worked in my instance:



Passed sysparm_test with a test value - here to make sure parameter is framed by the proper characters in the URL:


find_real_file.png



Global "New" UI action got hidden based on this condition:


find_real_file.png



Best regards,


Andras


are you going this in a list control for a related list or for a "normal list" like incident.list?


Hi Goran,



What I wrote applies to normal v2 platform lists, not related lists, not portal list widgets, and not list v3.



When applying omit new condition to a table it is important to check which "New" UI action is rendered on the list, the global one or it is override with a table-specific "New" button, as the buttons condition to hide them may check for different things.



For change_request list it should work when the global "New" button applies, which has its condition field containing !RP.getLIstControl().isOmitNewButton() which evaluates list control omit new condition field and shows/hides the new button.



find_real_file.png



Incident table, however, did not hide the button for me as (at least in my dev instance) it has a "New" UI action on incident table which overrides global and seems ignoring omit new condition...



find_real_file.png


Ahh there is the darn little thief... 😃 I was looking at List V3