Jelly Question: how to get values from the form?

tahnalos
Kilo Sage

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

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@tahnalos 

Hi,

you can use g_form object in <script> tag and access form fields

OR

you can access current object in <g:evaluate> tag

Can you share your complete UI macro script and what's not working?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

See my response to Allen Andreas.

At the very least, can you tell me what the two lines do?

<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_incidents_${jvar_guid}:${ref}"/>

 

Specifically, the gs.generateGUID line and the ref value afterwards.

One other question: we are trying to set things up so that the macro is initiated when a separate field does its action.  That is, when the separate field changes its value, the field with the macro does something (of course it is also dependant on the value of this separate field).  Using g_form doesnt seem to be working and one person suggests that the macro is only run when the field the macro itself is attached to is changed, and that one cannot trigger a macro from a separate field unless that field also has the macro.

Comments?