Using g_form.getValue in a UI Macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2009 08:58 AM
I have a UI macro associated with the company field on the Task table which generates a list of Incidents for the company (I have cloned and hacked the OOTB user_show_incidents UI Macro which is associated with the Caller field on the Incident table). I have created a custom table - Incident Task - which is an extension of the Task table - these records can only be created via a UI Action on the Incident form, so the Parent field is always set to the "owning" Incident. The Incident Task form displays the Company field from the parent Incident record (I don't copy the value of the Company field from the Incident to the children Incident Tasks).
Now for my issue - in my UI Macro script I do a g_form.getValue('company'); When the macro is called from the Incident form, this works fine, but when the macro is called from a child Incident Task form, I get a different value, even though the displayed value is the same - and I can't fathom how to use this value to get the reference to the core_company table that I need in my script.
Can anyone point me in the right direction?
Brian Broadhurst
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2009 05:31 AM
Hi,
I finally got the script to work using:
var s = reference.split('.');
var formName = s[0];
var fieldName = reference.substr(reference.indexOf(".") + 1);
var v = g_form.getValue(fieldName);
That takes everything after the first "." as the field name, so it doesn't matter if it being called by the parent or the child.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 01:40 PM
You actually can use g_form in a UI Macro