The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to get g_form.getUniqueValue() display value?

Keang
Tera Contributor

Hello,

This is primarily for educational purposes. 

Currently the following code populated the sys_id in the description. How do I it to display the ritm number instead of sys_id?   Thank you 

 

var recSysId = current.getUniqueValue();

var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', recSysId);
ritm.query();
if (ritm.next()) {
    ritm.description = recSysId;
   
} else {
    return false;
}
1 ACCEPTED SOLUTION

@Keang ,Thanks for marking my answer as helpful. If it helped you in any way please accept the solution so that it will be beneficial to the future readers with the same query

 

Regards,

Swathi

View solution in original post

7 REPLIES 7

swathisarang98
Giga Sage
Giga Sage

Hi @Keang,

 

while setting the value of description in business rule or in server side scripting set the number directly something as below,

 

 

 

var recSysId = current.getUniqueValue();

var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', recSysId);
ritm.query();
if (ritm.next()) {
    ritm.description =ritm.number; //which field value you want, you can dot walk with that field backend name;
} else {
    return false;
}

 

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

@Keang ,Thanks for marking my answer as helpful. If it helped you in any way please accept the solution so that it will be beneficial to the future readers with the same query

 

Regards,

Swathi

SK Chand Basha
Tera Sage

Hi @Keang we have getDisplayValueFor(String, String, String) method for getting field value from server side can you check with this method.

 

If it's works mark Helpful.