Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

glide.knowman.attach.fields set field in here

Add sys_template to glide.ui.permitted_tables

client script

https://community.servicenow.com/thread/143298

Added Template field to Knowledge article form

Knowledge Properties

Set the target of the knowledge article to a custom field on incident

Incident Client Script

This fires on change of the u_kb_article_template field.  We do things a little differently if we determine that there's tasks or other child templates on the template we're using.  If there are child templates we have to save the record first, if not we can just apply the template.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue == '')
		return;
	
	var template = g_form.getReference('u_kb_article_template').u_template;
	
	var ga = new GlideAjax('YaleAjax');
	ga.addParam('sysparm_name','hasChildTemplates');
	ga.addParam('sysparm_template',template);
	ga.getXML(hasTemplate);
	
	function hasTemplate(response) {
		answer = response.responseXML.documentElement.getAttribute("answer");
		if(answer == 'true'){
			// If there's child templates we have to save the record first
			g_form.checkMandatory = false;
			gsftSubmit(null, g_form.getFormElement(), 'apply_my_template');
		}else{
			// If there's no child record, no need to save before
			applyTemplate(template);
		}
	}
}


 

 

  • No labels