Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to access jvar in UI page client script

purbali1
Giga Expert

Hi,

I have one value set on jvar on UI Page HTMl and I want to show one alert message depending on the value set on submit of the UI page.

For that reason I want to check jvar value on onSubmit function of the UI page client script. I am not aware of the syntax on how to do that

HTML-

<g:evaluate expression="RP.getParameterValue('sysparm_flag')" var="jvar_flag"/>

Client Script-

function onSubmit() {

if (jvar_flag===<something>)       // not sure of the syntax

{

alert("something");

return false;

}

}

5 REPLIES 5

Hi,


I hope the problem is solved but nobody posted the correct answer.



I had a similar problem. Try changing the html "id"   and "name",


Then try calling using html "name", worked for me.



<input type=hidden> name="my_sys_id_n" id="my_sys_id" value="${anything}"



Then try


var sys_id= gel("my_sys_id_n").value;


in the client script.



Regards


Rajat