var
grRequestedItem = new GlideRecord('sc_req_item');
grRequestedItem.addQuery('number', 'RITM0016916');
grRequestedItem.query();
while (grRequestedItem.next()) {
gs.addInfoMessage('Variables for ' + grRequestedItem.getDisplayValue());
for (var prop in grRequestedItem.variables) {
if (grRequestedItem.variables.hasOwnProperty(prop) ){
var variable = grRequestedItem.variables[prop].getDisplayValue();
var v =
grRequestedItem.variables[prop];
if(v.getGlideObject().getQuestion().getLabel() != '') {
var label = v.getGlideObject().getQuestion().getLabel();
gs.print( label + ': ' + variable );
}
}
}
}
output:
[0:00:00.050] Script completed in scope global: script
Background message, type:info, message: Variables for RITM0016916 *** Script: Requester: R Smith *** Script: Requested for: R Smith *** Script: Line manager: Martyn *** Script: Server: BI01DW8BI001 *** Script: Type of access: privileged access *** Script: Justification / details: sd *** Script: Access from: 15/08/2018 *** Script: Access to: 22/08/2018
Comments
Post a Comment