Split the value from look up select box field and auto populate in single line text variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 12:26 AM
I have a look up select field where I am populating the values of u_code, u_label by seperator (u_code|u_label)
then I have a single text variable which is read only where I need to auto populate the u_code that is getting displayed in the look up select box field.
Here, I cannot change the Look up select box to Reference field.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 01:36 AM
yeah i am getting the sys)id of the record in info message
I am not allowed to change the variable type here.
please help me with GlideRecord and get the value of field u_code from that table
I tried and it is not working for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 12:50 AM - edited ‎01-23-2025 12:52 AM
Hi @satya30
Please try below code
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
// Get the selected value from the lookup select field (assuming it's 'u_lookup_select')
var selectedValue = g_form.getValue('u_lookup_select');
// Split the value at the separator (assuming format is u_code|u_label)
var uCode = selectedValue.split('|')[0]; // Extract the u_code part
alert(uCode);
// Set the u_code into the read-only text field (assuming it's 'u_code_field')
g_form.setValue('u_code_field', uCode);
}
If my response helped please mark it correct and helpful.
Thanks & Regards,
Sejal
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 01:10 AM
I tried this way, this is storing the sys_id of the record in the code field.
what needs to be done here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 01:16 AM - edited ‎01-23-2025 01:19 AM
What is added in 'Lookup value field' for look up select field ?
instead of
var selectedValue = g_form.getValue('u_lookup_select');
try using
var selectedValue = g_form.getDisplayValue('u_lookup_select');
For me its showing properly
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 01:19 AM
getDisplayValue works only for reference fields.
In the look up field it is take u_Code | u_label values to get displayed