- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 01:45 PM
Hello Everyone,
is something wrong with my script :
var visa ;
var g = new GlideRecord('sn_hr_core_profile');
g.addQuery('number=HRP0153690');
g.query();
if (g.next){
visa = g.getDisplayValue('u_employment_status');
gs.print("Print Visa value "+ visa);
}
Struck with simple query. Any help please ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 02:38 PM - edited 11-23-2022 07:38 PM
String fields do not have display values. Use getValue instead
visa = g.getValue('u_employment_status');
also in line 5, you are missing ()
g.next()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 02:38 PM - edited 11-23-2022 07:38 PM
String fields do not have display values. Use getValue instead
visa = g.getValue('u_employment_status');
also in line 5, you are missing ()
g.next()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 06:11 PM
Hi @kuttti,
Try this updated scripts -
var g = new GlideRecord('sn_hr_core_profile');
g.addQuery('number=HRP0153690');
g.query();
if (g.next()){
visa = g.getValue('u_employment_status');
gs.print("Print Visa value: "+ visa);
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 10:56 PM
Hi @kuttti ,
The getDisplayValue Works on the Reference fields as that record table value is already set as true ( Display = True ). For getting string field data you can use simply getValue as shown below or direct field name as
var visa= gr.u_employement_status
var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('number=HRP0153690');
gr.query();
if (gr.next()){
var visa = gr.getValue('u_employment_status');
gs.print("Print Visa value: "+ visa);
}
Please mark my answer as helpful/correct if it resolves your query.
Let me know if any issues….
---
Nilesh Wahule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 11:16 PM - edited 11-23-2022 11:47 PM
var visa ;
var g = new GlideRecord('sn_hr_core_profile');
g.addQuery('number=HRP0153690');
g.query();
if (g.next()){
visa = g.getDisplayValue('u_employment_status');
gs.print("Print Visa value "+ visa.toString());
}