Notifications

23 views

Description

The issue was introduced in London by the out-of-box MID selector override filter 'Override by capability'.

The script has a condition such that this MID Selection Override applies only for MID servers with Cloud Management capability. However, due an error in the code, this mid selector override applies for all capabilities.

Steps to Reproduce

  1. Use an out of box instance on London or Madrid Patch 2 configured with a single MID Server called: MIDABC
  2. Assign only one Capability to MIDABC e.g. Test1
  3. Assign one Supported Application e.g. Orchestration
  4. Pass two capabilities in the request for MidSelector(); the following script can be run as a background script to simulate this (in Global):
var midSelector = new SNC.MidSelector();
gs.print( midSelector.selectMid("Orchestration", null, [{"capability": "Test1","value": ""}, {"capability": "Test2","value": ""}], null )) ;

 

Expected result:

Unable to find any validated MID Server based on status 'xyz'

Actual result:

MID server MIDABC with capability Test1 is selected.

This is incorrect, an exception should have been thrown as a MID with both capabilities specified in the request does not exist. Both capabilities (Test1 AND Test2) should have been used to select a MID server.

Workaround

This problem is currently under review. You can contact ServiceNow Technical Support or subscribe to this Known Error article by clicking the Subscribe button at the top right of this form to be notified when more information will become available..

 

The bug is in the function 'hasCloudCapability' of the script configured for 'Override by capability' MID selector override.

Notice the semicolon at the end of "if" condition in the code below. This causes the condition to always return true and then run another function in the script 'getNonCloudCapability' (meant for only cloud management). This function returns only the first capability in the array of capabilities passed to MidSelector and an incorrect MID selection can happen.

function hasCloudCapability(capabilities) {
for(var j in capabilities) {
if(capabilities[j].capability == 'Cloud Management');
return true;
}

return false;
}

The workaround would be to remove the semicolon from the 'if' condition, so the code should look like the below -

function hasCloudCapability(capabilities) {
for(var j in capabilities) {
if(capabilities[j].capability == 'Cloud Management') return true;
}

return false;
}

 


Related Problem: PRB1346731

Seen In

There is no data to report.

Intended Fix Version

New York

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:2019-06-06 13:27:39
Published:2019-06-04