
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 12:57 AM
Hi Team,
I have a scenario where I want to auto populate list of incident records on multi row variable set that i have created on a catalog item,and i want to do it on load of the catalog item.
below are the details of it.
multi row variable set variable name: incident_details
var1 name:incident_short_description
var2 name:incident_description
var1 will have the short description of incident records
var2 will have description of incident records.
i want only the active incident details.
Request you to help on this requirement.
Thanks and regards
Nasheet Khan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 02:18 AM
try this out
Client callable Script Inlcude
var CatalogpostSol = Class.create();
CatalogpostSol.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getIncidetns:function(){
var res = [];
var incGr = new GlideRecord('incident');
incGr.addEncodedQuery('ORDERBYDESCsys_created_on'); // replace the encodedquery if needed
incGr.setLimit(5);
incGr.query();
while(incGr.next()){
var shortD = incGr.getValue('short_description');
var desc = incGr.getValue('description');
var tempObj = {};
tempObj.add_row_onload_to_multi_row_variable_set /*the variable name maps to SD*/ = shortD?shortD:'';
tempObj.column2 /*the variable name maps to description*/= desc?desc:'';
res.push(tempObj);
}
return JSON.stringify(res);
},
type: 'CatalogpostSol'
});
OnLoad Catalog Client Script
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('CatalogpostSol');
ga.addParam('sysparm_name','getIncidetns');
ga.getXMLAnswer(function(ans){
g_form.setValue('catalogpostsol'/*interName of the variable set*/,ans);
});
}
Regards,
Chaitanya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 01:58 AM
Hi,
Your question/scenario is hard to understand. Please elaborate. Also describe what the use case is.
And if possible add images to show how you mean.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2024 10:40 PM
Hi OlaN,
I have created a catalog item with multi row variable as variable with two columns.You can have a look at the below snapshot of the same.
Currently I am using the below script to populate the above values in the two columns when the catalog items is loaded.
Script:
------
My Requiremnet :
Now i want the data to be pulled from incident table and not hard coded as it is done in the script above.
I want from incident table short description and description.
Note:If you are not able to open the snapshot attached above you can have look at the attachment.
Thanks and regards
Nasheet Khan
+919955860495
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2024 11:45 PM
Hi @Community Alums ,
How do you know from which incident the short description and description should be pulled?
Do you have a UI action or something on the Incident table which opens the catalog form?
Regards,
Chaitanya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 12:01 AM
Hi Chaitanya,
I want to populate first five record's description and short description to be populate once the form is opened by end user.
Just open the catalog item either in service portal or in the platform view it simply populates the first 5 records description and short description.
Thanks and regards
Nasheet Khan
+919955860495