Allow templates to set category and subcategory

Brian Lancaster
Tera Sage

We have created some incident templates and are trying to set the category and subcategory.  When someone clicks on the incident template it you can see it set the category and subcategory at first but then subcategory gets set to -- None --.  How can we make it so that system does not set the subcategory to -- None -- when using a template?

1 ACCEPTED SOLUTION

Nithish1
Tera Guru

Hello Brian,

 

We have the same issue and I figured it out, there is a oob client script "Empty assigned_to on group change" and I just commented one line of code [g_form.setValue("assigned_to", "");] and it worked.

 

Thanks,

Nithish

 

Hit Helpful or Correct on the impact of response.

 

View solution in original post

9 REPLIES 9

I tried this and it works in my developers instance but for some reason is not working in the companies dev or test instance.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}
	//Type appropriate comment here, and begin script below
	
	if (!isTemplate){
		if (g_form.getValue('assignment_group') == 'a0cd82306f401f006f150f1aea3ee476'){
			g_form.clearOptions('category');
			g_form.addOption('category', '', '-- None --');
			g_form.addOption('category', 'Access Update', 'Access Update');
			g_form.addOption('category', 'Ad-hoc Request', 'Ad-hoc Request');
			g_form.addOption('category', 'Anomaly Monitoring', 'Anomaly Monitoring');
			g_form.addOption('category', 'Application Monitoring', 'Application Monitoring');
			g_form.addOption('category', 'Brand Protection Monitoring', 'Brand Protection Monitoring');
			g_form.addOption('category', 'Business Transaction Monitoring', 'Business Transaction Monitoring');
			g_form.addOption('category', 'Data Leakage-Reputation Monitoring', 'Data Leakage-Reputation Monitoring');
			g_form.addOption('category', 'Device Health Status', 'Device Health Status');
			g_form.addOption('category', 'Firewall Change', 'Firewall Change');
			g_form.addOption('category', 'Firewall Monitoring', 'Firewall Monitoring');
			g_form.addOption('category', 'Fraud and Transactional', 'Fraud and Transactional');
			g_form.addOption('category', 'Health Monitoring', 'Health Monitoring');
			g_form.addOption('category', 'Host Activity Monitoring', 'Host Activity Monitoring');
			g_form.addOption('category', 'Infrastructure (network)', 'Infrastructure (network)');
			g_form.addOption('category', 'Infrastructure Monitoring', 'Infrastructure Monitoring');
			g_form.addOption('category', 'Insider Threat Monitoring', 'Insider Threat Monitoring');
			g_form.addOption('category', 'Malware Defenses and Control Monitoring', 'Malware Defenses and Control Monitoring');
			g_form.addOption('category', 'Other Monitoring (Suspicious Traffic, etc)', 'Other Monitoring (Suspicious Traffic, etc)');
			g_form.addOption('category', 'Perimeter Monitoring', 'Perimeter Monitoring');
			g_form.addOption('category', 'Physical Access Monitoring', 'Physical Access Monitoring');
			g_form.addOption('category', 'Playbook', 'Playbook');
			g_form.addOption('category', 'Policy Enforcement Monitoring', 'Policy Enforcement Monitoring');
			g_form.addOption('category', 'Privileged User and Shared Account Monitoring', 'Privileged User and Shared Account Monitoring');
			g_form.addOption('category', 'security_incident', 'Security Incident');
			g_form.addOption('category', 'Service Monitoring', 'Service Monitoring');
			g_form.addOption('category', 'Service Request', 'Service Request');
			g_form.addOption('category', 'Tuning Recommendation', 'Tuning Recommendation');
			g_form.addOption('category', 'User Activity Monitoring', 'User Activity Monitoring');
			g_form.addOption('category', 'Vulnerability Monitoring', 'Vulnerability Monitoring');
		}
		else if (g_form.getValue('assignment_group') != 'a0cd82306f401f006f150f1aea3ee476'){
			g_form.clearOptions('category');
			g_form.addOption('category', '', '-- None --');
			g_form.addOption ('category', 'how_to', 'How To');
			g_form.addOption('category', 'informational', 'Informational');
			g_form.addOption('category', 'network', 'Network');
			g_form.addOption('category', 'voice', 'Voice');
			g_form.addOption('category', 'Security Incident', 'Security Incident');
		}
	}
}

Did you adjust the sys_ids of the groups for each environment? Any errors in the console? 

I exported the xml for the groups so the sys_id is the same.  I'm seeing the following on the console but I'm not sure what would be causing it.

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org

 *** WARNING *** GlideAjax.getXMLWait - synchronous function - processor: AjaxClientHelper

Use of getAttributeNode() is deprecated. Use getAttribute() instead.

The really strange thing is if I do at alert at the begging of my script alert(!isTemplate); in my personal dev it returns false when I click on a template but for some reason in my companies dev instance it returns true.

Nithish1
Tera Guru

Hello Brian,

 

We have the same issue and I figured it out, there is a oob client script "Empty assigned_to on group change" and I just commented one line of code [g_form.setValue("assigned_to", "");] and it worked.

 

Thanks,

Nithish

 

Hit Helpful or Correct on the impact of response.