- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2017 07:08 AM
Hi guys,
I have followed the workaround in the article in HI below...
I have then cloned the sp-variable-editor and embed it to the the Form cloned widget.
However the variables are still not displaying on the form.
Would you know what am I doing wrong?
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2017 03:18 AM
Hi guys I have debugged the server script, the reason the variables were not displaying is because I was viewing a record created from a record producer. I had to change the code to get the record producer sysid rather than the catalog item:
var gr = new GlideRecord(data.table);
if (gr.get(data.sys_id)) {
var recordClassName = gr.getRecordClassName();
console.log('recordClassNamee=' + recordClassName);
if (recordClassName != data.table) {
data.table = recordClassName
gr = new GlideRecord(data.table);
gr.get($sp.getParameter("sys_id"));
console.log('sysid=' + $sp.getParameter("sys_id"));
}
try {
//var catItem = data.table == "sc_task" ? gr.request_item.cat_item : gr.cat_item;
var catItem = gr.u_record_producer;
console.log('gr.cat_item=' + gr.cat_item);
// data.sc_cat_item = $sp.getCatalogItem(catItem);
//regina added params to the getCAtalogItem as these were introduced after Istanbul 3a+
//catItem = '13ffd3dddbd28b40f82ada94ce9619e3';
data.sc_cat_item = $sp.getCatalogItem(catItem,false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2017 03:18 AM
Hi guys I have debugged the server script, the reason the variables were not displaying is because I was viewing a record created from a record producer. I had to change the code to get the record producer sysid rather than the catalog item:
var gr = new GlideRecord(data.table);
if (gr.get(data.sys_id)) {
var recordClassName = gr.getRecordClassName();
console.log('recordClassNamee=' + recordClassName);
if (recordClassName != data.table) {
data.table = recordClassName
gr = new GlideRecord(data.table);
gr.get($sp.getParameter("sys_id"));
console.log('sysid=' + $sp.getParameter("sys_id"));
}
try {
//var catItem = data.table == "sc_task" ? gr.request_item.cat_item : gr.cat_item;
var catItem = gr.u_record_producer;
console.log('gr.cat_item=' + gr.cat_item);
// data.sc_cat_item = $sp.getCatalogItem(catItem);
//regina added params to the getCAtalogItem as these were introduced after Istanbul 3a+
//catItem = '13ffd3dddbd28b40f82ada94ce9619e3';
data.sc_cat_item = $sp.getCatalogItem(catItem,false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2017 07:13 AM
Hi Regina,
Thank you very much for the solution it worked very well. It worked for me - I just wanted to clarify how it worked:.
1. The formatter which displays the variables is located on the sp_ui_formatter table with a formatter of com_glideapp_servicecatalog_veditor
2. The fix you provided needs to be applied to the widget this formatter points to. Essentially var catItem variable needs to have the sys_id of the record producer in this case. This can be made to work with multiple tables if needed using if conditions for example:
if(data.table == "u_custom_table_1"){//So that variables can be displayed for the custom table you can have multiple if conditions for difference tables
var catItem = gr.u_cat_item; //A reference to the record producer the record is created from
}
else{
var catItem = data.table == "sc_task" ? gr.request_item.cat_item : gr.cat_item;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2019 03:05 PM
Hi Regina,
I have same requirement , I need to display variable editor under request on portal. can you please suggest me.
Regards,
Gari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2018 01:29 PM
Hi there, I am on a Kingston instance and I am unable to get this working... I may be misunderstanding exactly what you had done. Could you please provide me with your updated code for the cloned sp-variable-editor widget?