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 03:58 AM
Why do it from the portal, why not create assignment rules to update the record on creation so it ends with the correct group? You can get rid of the entire scripting to get the assignment group.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:01 AM
Application Name field is a reference field , we have 2lac above CI's , we can't create those many assignement rules right ,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:39 AM
How do you mean 'so many assignment rules'? It's just one: set assignment group to support group of CI (or whatever relation there is).
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:33 AM
@nameisnani Assuming its a record producer and it create a incident record in backend view
in record producer script
use below code :
if(producer.variable_name=="sysid of the applicationname from variable")
{
current.assignment_group=" ";//set the group you want to set
}
easy as you like.... 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