Error msg "There are multiple UI Policies with the same Order for this field - their run order is not predictable"

jamesgo
Giga Contributor

When I am updating an existing Wizard UI Policy, I got an error msg saying "There are multiple UI Policies with the same Order for this field - their run order is not predictable", it is followed by 3 UI policies with same name(and with same sys_id...) see the screeshot below.

When I click on any one of them, it leads me to an similar UI policy with no table associated with it...

Does anyone have seen this before?

5 REPLIES 5

CapaJC
ServiceNow Employee
ServiceNow Employee

That's the result of the "Show Conflict ErrorMessage" Business Rule that calls a function in the "policyActionConflicts" Script Include. Could be that there's some bad logic in it when you're looking at a policy action for a Wizard UI Policy.

You could deactivate the Business Rule (it's informational only), or you could add a condition to the rule so it doesn't run for Wizard UI policy actions: current.getTableName() != "expert_ui_policy_action"


CapaJC
ServiceNow Employee
ServiceNow Employee

Yeah, I see the problem with the Script Include function. It has specific logic for Catalog UI Policy Actions, but none for Wizard UI Policy Actions. I'm guessing it got created before Wizard UI Policies existed.

Would you mind opening an Incident with Customer Support for this, and simply tell them that I recommended in the community forum that they attach the Incident to Problem PRB591747 ? The Incident can be immediately closed, but Problems have a better chance of getting fixed when there are actual customer Incidents against them.

If you'd rather not, I understand.

If you want to fix the script yourself, change this part in the "policyActionConflicts" Script Include:



if (current.getTableName() == "catalog_ui_policy_action") {
gr.addQuery("catalog_item", current.catalog_item);
gr.addQuery("catalog_variable", current.catalog_variable);
}


To this:


if (current.getTableName() == "catalog_ui_policy_action") {
gr.addQuery("catalog_item", current.catalog_item);
gr.addQuery("catalog_variable", current.catalog_variable);
}
if (current.getTableName() == "expert_ui_policy_action") {
gr.addQuery("expert", current.expert);
gr.addQuery("expert_variable", current.expert_variable);
}


jamesgo
Giga Contributor

Hi CapaJC, looks like the script include we have doesn't have your below code at all, is it because we are on berlin? here is all the code in "policyActionConflicts" Script Include:



policyActionConflicts = function() {
if (current.active == false)
return "";

if (current.ui_policy.nil())
return "";

var gr = new GlideRecord("sys_ui_policy_action");
gr.addNotNullQuery("ui_policy");
gr.addQuery("table", current.table);
gr.addQuery("ui_policy.active", "true");
gr.addQuery("field", current.field);
gr.addQuery("ui_policy.order", current.ui_policy.order);
gr.query();
if (gr.getRowCount() <= 1)
return "";

var answer = "";
while (gr.next()) {
if (answer != "")
answer += ", ";
answer += "<a class='web' href='sys_ui_policy.do?sys_id=" + gr.ui_policy.sys_id + "'>";
if (!gr.ui_policy.short_description.nil())
answer += gr.ui_policy.short_description;
else
answer += "(" + gs.getMessage("empty") + ")";
answer += "</a>";
}
return answer;
}



CapaJC


CapaJC
ServiceNow Employee
ServiceNow Employee

Never mind about opening an Incident. This was a minor change, so I've just checked in a fix for the Eureka release.

In the meantime, you can still fix the script yourself, if you like, with what I added earlier. Note that if you fix the Script Include, you don't need to put a condition on the Business Rule. Either will make the false positive error msgs go away, while changing the Script Include will keep warnings working if there actually ARE conflicts for existing Wizard UI Policy Actions.