
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2019 02:23 AM
I am having problems passing a varible from a UI Page to a UI Macro.
This is the UI Page
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<h1>Test</h1>
<g:call function ="testMacro.xml" fieldName="xyz" />
</j:jelly>
I want to pass the value "xyz" to the ui macro.
The ui macro looks like this ( I removed all unnecessary code)
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:function test="REQUIRED" />
<div style="display:none">
<g:evaluate object="true" >
var token = gs.getSession().getSessionToken()?gs.getSession().session.getSessionToken():gs.getSessionToken();
</g:evaluate>
<script>
var value = "${jvar_test}"
</script>
</div>
</j:jelly>
I want the variable "value" to contain "xyz" but I cannot get this to work. I have tried all kinds of kombinations using {} or [] prefixing with jelly. etc. But the variable value is empty.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2019 07:16 AM
I used Chuck's guidance here but it still did not work until I tried a differen variable name.
I changed fieldName to field_name and it worked.
So apparently variable names cannot contain uppper case letters. I must have overlooked that somewhere.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2019 05:54 AM
Hello Jenson,
Please go through this site hope it will be helpful
https://dxsherpa.com/blogs/ui-macro-in-servicenow/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2019 06:21 AM
That link is no help. Actually it has less information than the official documentation and mention nothing about what I am asking about.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2019 07:16 AM
I used Chuck's guidance here but it still did not work until I tried a differen variable name.
I changed fieldName to field_name and it worked.
So apparently variable names cannot contain uppper case letters. I must have overlooked that somewhere.