Client Script are not working as Experted in service operation workspace.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2024 05:20 AM
Hi All,
I am working on a requirement where i need to write a script that if service area does not match the Support Organization of the group then the incident should through an alert and form should not be submitted in default view and service operation workspace view. The Same in Default view its working fine, but coming to Service operation workspace it not working as Expected. it is troughing an error.
function onSubmit()
{
//alert("Hello workspace");
var url = top.location.href;
if(url.indexOf('major_incident_workbench')<0){
var actionName1 = g_form.getActionName();
alert('actionName1'+actionName1);
var number=g_form.getValue('number');
//alert(number);
var ag=g_form.getDisplayBox('assignment_group').value;
// alert(ag);
if(actionName1!='sysverb_mim_propose'&& actionName1!='sysverb_mim_accept' && actionName1!='sysverb_mim_reject' && actionName1!='sysverb_mim_demote')
// alert("welcome workspace");
{
if(ag.indexOf('ServiceDesk')<0 && ag.indexOf('Atlas Copco IT Services child tickets')<0 )
{
//alert("welcome sow");
var assignment_group =g_form.getValue('assignment_group');
var u_service_area =g_form.getValue('u_service_area');
// alert(assignment_group);
if (!window) {
if (g_scratchpad.isFormValid) {
return true;
}
g_form.hideAllFieldMsgs('error');
var actionName = g_form.getActionName();
//Check if google group already exists
var rec = new GlideRecord('sys_user_group');
rec.addQuery('sys_id', assignment_group);
//Callback function to control stop submit asynchronously
rec.query(function() {
var area = rec.u_support_organization_area;
// alert(area);
if (rec.next()) {
if(rec.u_support_organization_area!=u_service_area)
{
// alert("inner loop");
alert("Ticket Service Area does not match the Support Organization of the group which is " + rec.u_support_organization_area + "");
return false;
}
}
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
});
return false;
}
}
}}
}
So please help me how to resolve it.
Labels:
- Labels:
-
Service Operations Workspace
0 REPLIES 0