Variable editor not showing in Service Portal ticket view for REQ's

Dedrei L_
Tera Contributor

I have cloned and made a very slight customisation, to remove the save button and make it read only, to the OOB sp-variable-editor widget.  I have added my cloned widget to the ticket page for end users to view a read only copy of their submitted form.  This is working perfectly fine for all forms being submitted except for REQ's whether catalog items or record producers on sc_request table.  When viewing the ticket page in the portal for any submitted REQ the variable editor widget does not display at all.

Any advice on what I need to update in order for the variable editor to work on the sc_request table?

Thanks

 

12 REPLIES 12

Harsh Vardhan
Giga Patron

I think ootb variable editor available on sc_req_item table not on sc_request table. 

This is how it has designed, if you will check the server side script it has not applied for sc_request table, even you will define the formatter on sc_request table, it wont be able to fetch the value. 

Thanks for your response.  How does it work for all other tables then, including incident and other's that extend task but just not for sc_request?

Technical justification. 

 

find_real_file.png

 

GlideappVariablePoolQuestionSet() : when you will run this function and pass the request sys_id in set.setRequestID() then it will not be able to fetch the variables because when you submit the catalog form using "order now" and workflow associated with ritm or request, it link the variables on ritm end . 

 

Now giving you another example for GlideappSequencedQuestionSet() , example you have a record producer on incident table then this will give you the variable details

or if you have record producer on sc_request table then this scenario it will show the record. 

 

Script which you can run at your end using background script to test the result. 

 

 

var gr = new GlideRecord('task');
gr.get('1e70eacf2f34a8d0f68d5ff62799b687'); // Add your sys_id of record

// Catalog Form 
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(gr.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getDisplayValue() != '' && +vs.get(i).getLabel() != '') {

gs.print("Catalog form "+ '<b>' +vs.get(i).getLabel() + " = " + '</b>' + vs.get(i).getDisplayValue() + "\n");

}
}

// Record Producer 
var set = new GlideappSequencedQuestionSet();
set.setTableName('sc_request');
set.setTableSysID(gr.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
gs.print('Record Producer +   vs.get(i).getLabel() + " = "+ vs.get(i).getDisplayValue() + "<br />");

}               

 

 

Test result. I have considered both scenario ( created request using catalog form as well as Record Producer.) 

 

find_real_file.png

 

 

Thank you so much for all the trouble you went through to help me.  I will have a closer look, use your script and test a few things on Monday and let you know how I go.  At the moment my record producers on sc_request table are not showing the variable editor in the portal, but all other record producers are.