Display reference field value into string fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 02:23 PM
My script is not working:
var one = current.u_group.getDisplayValue();
var gr=new GlideRecord('sysapproval_approver');
gr.addQuery('document_id', current.sys_id);
gr.query();
if(gr.next())
{
gr.u_kb_group=one;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 02:49 PM
try like this,
- var gr = new GlideRecord('sysapproval_approver');
- gr.query();
- while (gr.next())
- {
- var kbgrp = gr.getDisplayValue('referencefieldname'); //Get the current Reference value /
- gr.setValue('stringfieldname', kbgrp); // Set the value of the string.
- gr.update(); //Save it
- }
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 07:51 PM
Hi,
I think it is not working.
U_group(reference) field is available in KB table record.
And u_kb_group (string) field is available in Approver table record....
As per your script-you have taken two fields from approver table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 02:51 PM
D Kishore,
Can you provide more information about this (what I assume is a business rule) script?
Have you tried putting in some logging statements to see if your code is being fired, or where it is failing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 07:54 PM
It is firing, but sometimes, Otis not
Means if we have 5approvers in one KB record, value it is reflected only to 2 or 3 approver records, in reaming 2 records group name is not reflected.
That is the issue.