- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 02:13 AM
How do I set the a reference field value in a ui page?
I currently have this:
HTML:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 03:11 AM - edited 06-21-2024 03:11 AM
I don't think there is any official documentation for it. This is what is known to me:
- id – unique id for the input field
- name – unique name for the input field (should be the same as id in most cases)
- value – (optional) sys_id of the record selected by default
- displayvalue – (optional) display value of the record selected by default
- table – name of the table to query from
- query – encoded query string to pre-filter the list (i.e. a reference qualifier)
- completer – AJAXReferenceCompleter (default) or AJAXTableCompleter
- columns – a semicolon-separated list of fields to display in the dropdown (only works with AJAXTableCompleter)
- onChange – client-side code to execute when the value changes
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 02:56 AM - edited 06-21-2024 03:07 AM
You can use value and displayvalue attributes to prepopulate your reference field:
<g:ui_reference name="assigned_to" id="assigned_to" table="sys_user" query="active=true" value="62826bf03710200044e0bfc8bcbe5df1" displayvalue="Abel Tuter" />
From a client script, you can access the values as follows:
var user_id = $('assigned_to').value; // grab the sys_id
var user_name = $('sys_display.assigned_to').value; // grab the display value
Or change them like this:
$('assigned_to').value = '46d44a23a9fe19810012d100cca80666';
$('sys_display.assigned_to').value = 'Beth Anglin';
What other attributes are you looking for?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 03:02 AM
Hi,
What other attributes are there for the ui_reference fields. Are they documented somehwere?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 03:11 AM - edited 06-21-2024 03:11 AM
I don't think there is any official documentation for it. This is what is known to me:
- id – unique id for the input field
- name – unique name for the input field (should be the same as id in most cases)
- value – (optional) sys_id of the record selected by default
- displayvalue – (optional) display value of the record selected by default
- table – name of the table to query from
- query – encoded query string to pre-filter the list (i.e. a reference qualifier)
- completer – AJAXReferenceCompleter (default) or AJAXTableCompleter
- columns – a semicolon-separated list of fields to display in the dropdown (only works with AJAXTableCompleter)
- onChange – client-side code to execute when the value changes
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2025 10:26 AM
Hi,
Do you know how I can allow users to search for records using different fields?
For instance, if we have a <g:ui_reference> for table incident, how would users be able to search for a specific incident by number (should be the default seach field) but also by caller's name for example? Is that possible?
Thank you