Jelly Script get Parameter from URL

rad2
Mega Sage

Hello,

I am trying to get parameter from the URL in UI pages.

URL - https://xxxxxx.service-now.com/incident.do?sys_id=-1&sys_is_list=true&sys_is_related_list=true&sys_target=incident

I have tried the below code

<g:evaluate var="jvar_sys">
    var sysparm_id = RP.getParameterValue("sys_target") + "";
    sysparm_id;
</g:evaluate>


<span>${jvar_sys}</span>

 

This works when i try to get sys_id but returns blank when used for sys_target

Is there any way to get it work for other parameters?

 

1 ACCEPTED SOLUTION

Hi,

then this should work fine

<g:evaluate var="jvar_sys" jelly="true" object="true">
    var sysparm_id = gs.action.getGlideURI().getMap().get('sys_target');
    sysparm_id;
</g:evaluate>

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@rad

this should work fine

<g:evaluate var="jvar_sys" jelly="true" object="true">
    var sysparm_id = '$[sys_target]';
    sysparm_id;
</g:evaluate>


<span>${jvar_sys}</span>

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello, Tried this and it still doesnt work

Hi,

are you sending the correct url parameter name and value

how are you calling the UI page

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

It worked well for me

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

It works for sys_id. but when i try for other parameters like sys_target. it doesnt work.

im checking the attachments UI page