- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 09:48 AM
In the below variable I need to show the incidents only which are requested by the logged in user and the incidents which are raised on behalf of someone.
Please suggest .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 09:13 AM
Hi @Archana23
i have written the script not for the reference variable so i can check the code and will modify the code for reference variable
thanks and regards
Sai venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 10:42 AM
Hi @Archana23
You can use the below code (client script and script include)
Client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var categoryvalue = g_form.getValue('caller_id');
var inci = new GlideAjax('incidentdetailsoftickets');
inci.addParam('sysparm_name', 'getincidetails');
inci.addParam('sysparm_category',categoryvalue);
inci.getXMLAnswer(callback);
function callback(response) {
var answer = response;
alert(answer);
answer=answer.split(',');
for(var i=0; i<answer.length;i++){
g_form.addOption('u_incident_values',answer[i],answer[i]);
}
}
//Type appropriate comment here, and begin script below
}
Script Include:
var incidentdetailsoftickets = Class.create();
incidentdetailsoftickets.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getincidetails: function() {
//var calleridvalue=this.getParameter('sysparm_category');
var incidentvalues = [];
var incidentfetch = new GlideRecord('incident');
incidentfetch.addQuery('caller_id',gs.getUserID());
incidentfetch.query();
while (incidentfetch.next()) {
incidentvalues.push(incidentfetch.number.toString());
gs.info("the valeus are "+incidentvalues);
}
return incidentvalues.toString();
},
type: 'incidentdetailsoftickets'
});
It will create the values in the drop down (the incidents created by loggedin whose callerid is sameas loginuser) and it is working in my PDI
Thanks and regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 11:02 PM
Hi @SAI VENKATESH ,
Thanks for your solution.
I am getting the incidents which are raised by me in the alert not in the variable.
Below are the client script and script include which I have replicated.
Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 06:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 07:50 AM
I am using reference field and referring to incident table.