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 use gs.setProperty() in UI Macro

Saroj Patel
Tera Expert
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	
<script>
	gs.setProperty('Bulk','Hello World');
	
</script>
	
</j:jelly>
	

I am working on some requirement where i have to set system property with some json value but this syntax is not working .

i am getting undefined value in my system property.

find_real_file.png

1 ACCEPTED SOLUTION

There is an alternative too.

Inside your <script> tags, use glideajax and call a script include. In the script include you can have all your server side stuff like gs.setProperty().

View solution in original post

5 REPLIES 5

AnirudhKumar
Mega Sage

Use <g:evaluate> tag in place of <script> tags.

<g:evaluate> is where you can write all your server-side code.

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


gs.setProperty('Bulk','Hello World');


</g:evaluate>

Hi AnirudhKumar
 
 
I am converting excel to JSON in that script so i have to store that json value 
 
so gs.setProperty must be i script.
 
or iis there any alternative way to do this.

 

You can still write all your javascript code inside <g:evaluate> tags.

if-else, loops all these can be done from within <g:evaluate>

There is an alternative too.

Inside your <script> tags, use glideajax and call a script include. In the script include you can have all your server side stuff like gs.setProperty().