30 views

Description

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.

Workaround

  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);
    	name.get(tempFields.getValue('value'));
    	
    	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');
    	}
    	else
    		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.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-06-25 05:49:07
Published:2018-06-25