When searching for assets in facilities, field service templates do not work.

Steps to Reproduce

  1. Install Facilities Management with demo data.

    For more information, see the product documentation topic Facilities Service Management.

  2. Open any Facilities Request Template.

  3. Click Edit Fields and add the Asset field to the request.

  4. Attempt to search for an asset starting with the string "FAC".

    Note that the search does not work.


  1. Edit the _readNewTemplateFields function SMTemplateHelper Script Include. Remove the if (fieldType == 'reference) if block and replace it with the following code.

    if (fieldType == 'reference') {
    	var reference = gr.getElement(tempFields.field).getED().getReference();
    	var name = new GlideRecord(reference);
    	var qualifier = '';
    	if(appName == 'hr' && newField['name'] == 'request_category')
    		qualifier = 'active=true';
    	else {
    		var refQual = gr.getElement(tempFields.field).getED().getReferenceQualifier();
    		if (refQual && !refQual.startsWith("javascript:"))
    			qualifier = refQual;
    	newField['ed'] = {
    		'displayValue' : name.getDisplayValue(),
    		'qualifier' : qualifier,
    		'reference' : reference,
    		'value' : tempFields.getValue('value')
    	newField['qualifier'] = qualifier + '';
    	newField['reference'] = reference + '';
    	var ed = gr.getElement(tempFields.field).getED();
    	if (ed.hasAttribute('ref_ac_columns_search') && 
    		ed.getAttribute('ref_ac_columns_search') == 'true' &&
    		ed.hasAttribute('ref_ac_columns') &&
    		(ed.getAttribute('ref_ac_columns') && true)) {
    		newField.ed.attributes = 'ref_ac_columns_search=true,ref_ac_columns=' + ed.getAttribute('ref_ac_columns');
    	else if (ed.hasAttribute('ref_ac_order_by') && 
    			 (ed.getAttribute('ref_ac_order_by') && true)) {
    		newField.ed.attributes = 'ref_ac_order_by=' + ed.getAttribute('ref_ac_order_by');
    		newField.ed.searchField = name.getDisplayName();
  2. Open the template to which you'd like to add the asset field. Add the asset field and save the template.

  3. Reload the page and click Edit fields.

    You should now be able to search the asset field.

Related Problem: PRB1291638

Seen In

There is no data to report.

Intended Fix Version


Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-09-05 16:02:47