create incident record producer issue in Service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 03:52 AM
Hi Team ,
can any one please help me here .
When we are creating incident from Platform .
If we select category > Application then Department , Application name and Issue type will appears, for more info please refer the screenshot below .
Here Application Name is reference field , which refers to 'cmdb_ci_service_list' table , Please refer the screenshot below .
If i select Application Name with some value
Exmaple : - Application name > Firewall Production , Then automatically associated assignment group populated ( Tcs Network sup).
Show in screenshot .
Platform side everything is working fine , When comes to Serivceportal side .
I have selected ' Application name has ' Firewall Production' .
And i submitted the incident.
If u noticed here , Assignment group is blank , I don't know what was the issue here .
Scripts we have for this
u_taskAjax = Class.create();
u_taskAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getassignmentgroup: function() {
var trgt = this.getParameter('sysparm_target');
var serviceGR = new GlideRecord('cmdb_ci_service');
serviceGR.addQuery('sys_id', trgt);
serviceGR.query();
if (serviceGR.next()) {
return serviceGR.support_group;
}
},
type: 'u_taskAjax'
});
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//To auto populate assignment group based on services.
var business_service = newValue;
var businessServiceAjax = new GlideAjax('u_taskAjax');
businessServiceAjax.addParam('sysparm_name', 'getassignmentgroup');
businessServiceAjax.addParam('sysparm_target', business_service);
// submit request to server, call ajaxResponse function with server response
businessServiceAjax.getXML(subAjaxResponse);
}
function subAjaxResponse (response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('assignment_group', answer);
g_form.update();
}
var isMobile = GlideMobileExtensions.getDeviceType() == 'm';
var link = isMobile ? '#/!list/incident/q:active=true%5Ecaller_id=javascript:gs.user_id()%5EEQ' : 'home.do';
var linkLbl = isMobile ? "List" : "Homepage";
var br = '<br/>';
var linkURL = '<a href="' + link + '">' + gs.getMessage(linkLbl) + '</a>';
var msgArgs = [br, linkURL];
var info = gs.getMessage("This incident was opened on your behalf{0}. The IT department will contact you if they need any further information{0}You can track status from this {1} {0}", msgArgs);
gs.addInfoMessage(info);
var caller = gs.getUserID();
var parent_table = RP.getParameterValue('sysparm_parent_table');
if (JSUtil.notNil(parent_table)) {
var parent_map = new GlideRecord('request_parent_mapping');
parent_map.addQuery('parent_table', parent_table);
parent_map.query();
if (parent_map.next())
var requested_for_field = parent_map.getValue('requested_for_field');
var parentGR = new GlideRecord(parent_table);
parentGR.addQuery('sys_id', RP.getParameterValue('sysparm_parent_sys_id'));
parentGR.query();
if (parentGR.next())
caller = parentGR.getValue(requested_for_field);
}
current.contact_type = 'self-service';
current.caller_id = caller;
var prodCommentStr = producer.comments + "";
/*if (prodCommentStr.length > 80)
current.short_description = prodCommentStr.substring(0, 80);
else
current.short_description = prodCommentStr;
*/
current.description = prodCommentStr;
var incRPUtil = new LinkRecordProducerToIncident();
incRPUtil.linkRecordProducerToParentIncident(RP.getParameterValue('sysparm_parent_sys_id'), current);
So , our issue when ever from ServicePortal side ,
Based on Application Name field Value , Assignement group has to be pouplate .
Please review our script , what steps need to do .
can anyone please help me here with steps to achieve this issue .
Thanks in advnance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:54 AM - edited 05-06-2024 04:55 AM
@nameisnani
i have already given you the code,
so this will be static code and also there will be 1000 of ci's created for application but be sure to use only those which are required.
if(producer.variable_name=="sysid of the applicationname from variable")// here after equal to check in the table cmdb_ci which are in use CI and use them here as SYS_id because it will be reference variable in catalog item
{
current.assignment_group=" ";//set the group you want to set //here also get the sys id of the group you want to set for the CI
}
let me know if this works.
Please accept the solution /mark this response as correct or helpful if it assisted you with your question.
Regards,
Animesh