How to display the value of a variable in jelly script

jmweli
Kilo Expert

Hi ServiceNow Developers,

 

In jelly script how do I display the value of a variable? For instance in javascript I can use alert in a client script or gs.log in business rule or script include. I am currently debugging jelly script code and would like to know how can I display the value of a variable.

 

Kindly advise.

 

Thanks,

Johannes

8 REPLIES 8

neetusingh
Giga Guru

For displaying the value of javascript variable in the jelly code, you can use the below syntax :



${variable_name} / $[variable_name] --- depending on the phase({} - phase 1 and [] - phase 2 )



And for displaying the value of jelly variable under the javascript code, use below syntax :



jelly.jvar_variablename



I hope this helps you...


Thanks neetusingh,



I will definitely give this a try and will let you know how it goes.



Joe


dalton1
Giga Expert

Hi Johannes Mweli,



Has this been answered already?



As an alternative, you could use below tag to print the value for the specified variable. If variable is not specified, it will print all the values of all the available variables.



Example: (Print the value of   sysparm_view )



<g:breakpoint var="sysparm_view"/>


Thanks Dalton, your answer was very helpful