To get URL Parameters using Jelly

surya123
Mega Guru

Hi All,

I have the uRL as

https://instance.service-now.com/Test/Test_page.do?sysparm_document_key=TestTable,b897c9c04f29d2006c...

The parameters in my Url are Tablename, sysid of the record.

I want to write a jelly script so as to achieve the below functionalities :-

1. How can I retrieve just the sysid from the above URL and convert the sysid to display value of the record.

2.How to set the value retrieved in 1st step to a custom field

Thanks

Surya

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Surya,



In your jelly, you can do RP.getParameterValue('sysparm_document_key'); to grab that url parameter value. You can then use it to get a gliderecord for your record.



Extensions to Jelly Syntax - ServiceNow Wiki


Hi Brad




<g:evaluate var="jvar_gr" object="true" jelly="true">


                var gr = new GlideRecord("TestTable");


                          gr.get(jelly.sysparm_document_key);


  gr;


</g:evaluate>


${sysparm_document_key}


It is yielding me tablename and sysid.


I am not able to just get the sysid out of there



Thanks


Surya


Brad Tilton
ServiceNow Employee
ServiceNow Employee

If you just want the sys_id, you could do this:



<j:set var="jvar_doc_id" value="${RP.getParameterValue('sysparm_document_key')}" />


${jvar_doc_id}


Hi Brad,



Its giving me a blank with this


<j:set var="jvar_doc_id" value="${RP.getParameterValue('sysparm_document_key')}" />


${jvar_doc_id}




Thanks


Surya