Jelly Question: how to get values from the form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 06:10 PM
I'm relatively new to Jelly scripting and would like some assistance on this.
I have a field that needs a UI macro attached to it. The purpose of this macro is to grab some info from other fields to do a lookup in a third party database. Would like to know how to grab this data in Jelly to send the data.
Can someone point me in the right direction on how to retrieve info from elsewhere in the record?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 07:17 PM
Hi,
I'd recommend reviewing the UI Macro such as: user_show_incidents
From here, you can evaluate things and test some things out. I believe you're able to use g_form.getValue, same as you would within a Client Script, but the difference is that the UI Macro is called upon form load and so whatever the values were at that time, is what you have access to. If you're relying up live client changes, you won't get that in a UI Macro, from my understanding.
It's always best to look at out of box code and try and work on things from there, then search forums and such.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2022 10:00 PM
Hello. Thanks for your response.
I am looking at the macro user_show_incidents as a template, but I am having trouble understanding one part of the code as identified here:
<?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:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_incidents_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
What appears to be throwing me off is the statement gs.generateGUID(this);
As far as I know, generateGUID is supposed to be generating a fresh sys_id, so having it seen done in this way is causing some confusion. Is it generating a brand new sys_id in this instance to replace the existing sys_id of the incident? And what is the ${ref} for in the line afterwards?
Thanks for your help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 01:09 PM
Hello,
If my reply above was Helpful...please mark it as such.
Have you attempted to simply access the field values using <script> (as I pointed out in the macro that already exists) and then using g_form.getValue('field_name'); etc.
Your question was related to getting the field values.
You responded to someone else, about you using g_form, but you're saying it's not working, you've provided no script to show us where you're at so far, where you're troubleshooting with console/log statements, etc. and again, I'm the one who mentioned that so feel free to reply to me about that. I just happened to scroll down and see you reply to someone else about it else I wouldn't have caught that.
I've also explained when the UI Macro is initiated and when the field values are captured onLoad, etc.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 01:53 PM
Hi Allen.
There appears to be some confusion regarding your statement that macros are called from when the form loads, and not when a field changes.
Earlier, I had viewed a demo in which someone was able to show me a macro attached to the location field in which the macro was able to display a different map based on where the location was pointing to. There's obviously some onChange functionality going on here so I'm kind of putting shots in the dark.
I guess my issue here is that I have no clue as to what I'm doing. I have spent a lot of time on the server side of things and my weakest knowledge involve the web interface. I have simply been told to do a UI macro to do this third party lookup based on changing info. I haven't yet seen a resource explaining how UI macros work and when reviewing the user_show_incidents macro you provided, I have more questions than answers, and that none of the code appears to make any sense. My initial macro won't even run any code and I don't know how to even debug that.