How to display the value of a variable in jelly script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 09:14 AM
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
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 05:22 AM
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 12:54 PM
Thanks neetusingh,
I will definitely give this a try and will let you know how it goes.
Joe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2015 08:43 PM
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"/>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2015 06:38 PM
Thanks Dalton, your answer was very helpful