Get display value of variable from hr case variable editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi All,
I am using a system property to keep all the variable backend name and passing to a function to get the value , now the problem is while passing from the system property i am passing string as well as reference value, how to get the display value of reference,i am using gliderecord object hrcase. Please help me on this, thanks in advance
hrCase.variables[fieldname];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Ankur Bawiskar @Ravi Gaurav @pratikjagtap , I want to access mrvs variable but i am unable to access it , I tried the below code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
what's your business requirement?
you can get json key names i.e. variable names using this
if (hrCase.next()) {
var mrvs = hrCase.variables.test_mrvs;
if (mrvs) {
var arr = JSON.parse(mrvs);
var keyObj = {};
for (var i = 0; i < arr.length; i++) {
var obj = arr[i];
for (var key in obj) {
keyObj[key] = true; // collect unique keys in an object
}
}
// Convert keys from object to array
var keyNames = [];
for (var key in keyObj) {
keyNames.push(key);
}
gs.info(keyNames);
} else {
gs.info('No MRVS found with variable name: ' + variableName);
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
