Retrieve values from variables in a RITM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi, I'm trying to retrieve all the variables from a RITM using a script include to send all the item's variables via email as soon as it's created (I'm creating it via script include because all requests should generate this email), but I can't get their values. Can anyone figure out where I'm going wrong?
...
...
getRecordVariables: function(record) {
var varHtml = [];
var tableName = record.getTableName();
var recordSysId = record.getUniqueValue();
try {
if (tableName === 'sc_req_item') {
varHtml = this._getVariablesFromRitmDirecto(recordSysId);
return varHtml.join('');
}
--------------
_getVariablesFromRitmDirecto: function(ritmSysId) {
var varHtml = [];
var gr = new GlideRecord("sc_item_option_mtom");
gr.addQuery("request_item", ritmSysId);
gr.query();
while (gr.next()) {
var question = gr.sc_item_option.item_option_new;
var label = question.getDisplayValue("question_text");
var value = question.getValue("value");
if (label && value) varHtml.push('<b>' + label + ':</b> ' + value + '<br>');
}
return varHtml;
},
0 REPLIES 0
