UI Action to get field value from sysID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 05:50 PM
I am trying to get product id from current form on UI Action script, So for that I am getting sys_id using selecting the record which I am getting as
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 06:26 PM
Hi @mrunalnikhi
@please try this
// Get the selected sys_id(s)
var keys = g_list.getChecked();
// Check if multiple sys_ids are selected
var sysIdsArray = keys.split(',');
// Initialize GlideRecord for 'sn_ind_tmt_orm_c360_products'
var gr = new GlideRecord('sn_ind_tmt_orm_c360_products');
// If there's more than one sys_id, use addQuery with 'IN'
if (sysIdsArray.length > 1) {
gr.addQuery('sys_id', 'IN', sysIdsArray);
} else {
// Otherwise, query for the single sys_id
gr.addQuery('sys_id', keys);
}
// Query the table
gr.query();
while (gr.next()) {
var displayValue = gr.u_service_id;
alert('displayValue: ' + displayValue);
}
Please mark my answer correct and helpful if this works for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 06:59 PM
Thanks for the solution, but still it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 07:36 PM - edited 09-20-2024 07:47 PM
@mrunalnikhi if you want current form field data..then simply use g_form.getValue('u_service_id') and write GlideAjax logic
otherwise if you go with ur script logic and .directly call script include by passing keys In function parameter
- But in script include just change addQuery('sy_id','IN',keys) and use while loop