origam.com

Function 'AS:IsFeatureOn()' has failed because of a missing unique index

There is an Entity Rule in ERP - Is_Marketing_CampaignSelectionByGoal_On. There is an error during screen loading, that the feature is not found. But it is present - twice.

image

stack trace:

2021-08-18 07:39:46,604 [57] ERROR Origam.ServerCore.Controller.AbstractController - Vykonání pravidla 'Is_Marketing_CampaignSelectionByGoal_On' se nezdařilo.

System.Exception: Vykonání pravidla 'Is_Marketing_CampaignSelectionByGoal_On' se nezdařilo.

 ---> System.Xml.XPath.XPathException: Function 'AS:IsFeatureOn()' has failed.
 ---> System.ArgumentOutOfRangeException: Requested feature not found in the current model. (Parameter 'featureCode')
Actual value was Marketing_CampaignSelectionByGoal.
   at Origam.Workbench.Services.ParameterService.IsFeatureOn(String features) in D:\a\1\s\origam-source\Origam.Workbench.Services\ParameterService.cs:line 488
   at Origam.Rule.IsFeatureOnFunction.Invoke(XsltContext xsltContext, Object[] args, XPathNavigator docContext) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 5411
   at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)
   --- End of inner exception stack trace ---
   at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)
   at System.Xml.XPath.XPathNavigator.Evaluate(XPathExpression expr, XPathNodeIterator context)
   at Origam.Rule.RuleEngine.EvaluateXPath(String xpath, Boolean isPathRelative, OrigamDataType returnDataType, XPathNavigator nav, XPathNodeIterator contextPosition) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 4470
   at Origam.Rule.RuleEngine.EvaluateRule(XPathRule rule, IXmlContainer context, XPathNodeIterator contextPosition) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 4295
   at Origam.Rule.RuleEngine.EvaluateRule(IRule rule, Object data, XPathNodeIterator contextPosition, Boolean parentIsTracing) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 2337
   --- End of inner exception stack trace ---
   at Origam.Rule.RuleEngine.EvaluateRule(IRule rule, Object data, XPathNodeIterator contextPosition, Boolean parentIsTracing) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 2337
   at Origam.Rule.RuleEngine.IsRuleMatching(XmlContainer data, IRule rule, String roles, XPathNodeIterator contextPosition) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 4081
   at Origam.Rule.RuleEngine.RowLevelSecurityState(XmlContainer originalData, XmlContainer actualData, String field, CredentialType type, Guid entityId, Guid fieldId, Boolean isNewRow) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 4028
   at Origam.Rule.RuleEngine.RowLevelSecurityState(DataRow row, Object profileId, Guid formId) in D:\a\1\s\origam-source\Origam.Rule\RuleEngine.cs:line 3774
   at Origam.Server.SessionStore.RowStatesForDataLessSessions(String entity, Object[] ids, Object profileId) in D:\a\1\s\origam-source\Origam.ServerCommon\Session Stores\SessionStore.cs:line 1395
   at Origam.Server.SessionStore.RowStates(String entity, Object[] ids) in D:\a\1\s\origam-source\Origam.ServerCommon\Session Stores\SessionStore.cs:line 1386
   at Origam.Server.SessionStore.GetChangeInfo(String requestingGrid, DataRow row, Operation operation, Func`3 RowStateProcessor) in D:\a\1\s\origam-source\Origam.ServerCommon\Session Stores\SessionStore.cs:line 1082
   at Origam.Server.SessionStore.GetChangeInfo(String requestingGrid, DataRow row, Operation operation) in D:\a\1\s\origam-source\Origam.ServerCommon\Session Stores\SessionStore.cs:line 1065
   at Origam.ServerCommon.FormSessionStore.GetRowData(String entity, Object id, Boolean ignoreDirtyState) in D:\a\1\s\origam-source\Origam.ServerCommon\Session Stores\FormSessionStore.cs:line 385
   at Origam.ServerCore.ServerCoreUIService.GetRowData(MasterRecordInput input) in D:\a\1\s\origam-source\Origam.ServerCore\ServerCoreUIService.cs:line 394
   at Origam.ServerCore.Controller.UIServiceController.<>c__DisplayClass17_0.<MasterRecord>b__0() in D:\a\1\s\origam-source\Origam.ServerCore\Controller\UIServiceController.cs:line 177
   at Origam.ServerCore.Controller.AbstractController.RunWithErrorHandler(Func`1 func) in D:\a\1\s\origam-source\Origam.ServerCore\Controller\AbstractController.cs:line 120

Maybe it should only be present once?

Probably yes. After deleting duplicate record, it started to work.

We should include a unique index into OrigamFeatureList table so this could not happen.

@koki Please test this

I got this error even with unique index on ReferenceCode column. It happen to me today. Master 2021.2.0.2369

image

2022-01-28 10:09:10,945 [34] ERROR Origam.ServerCore.Controller.AbstractController - Rule evaluation failed. Rule: 'Is_Marketing_CampaignSelectionByGoal_On'

System.Exception: Rule evaluation failed. Rule: 'Is_Marketing_CampaignSelectionByGoal_On'

 ---> System.Xml.XPath.XPathException: Function 'AS:IsFeatureOn()' has failed.
 ---> System.ArgumentException: Item has already been added. Key in dictionary: 'Features'  Key being added: 'Features'
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at Origam.Workbench.Services.ParameterService.get_FeatureList() in D:\a\1\s\backend\Origam.Workbench.Services\ParameterService.cs:line 572
   at Origam.Workbench.Services.ParameterService.IsFeatureOn(String features) in D:\a\1\s\backend\Origam.Workbench.Services\ParameterService.cs:line 483
   at Origam.Rule.RuleEngine.IsFeatureOn(String featureCode) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 1942
   at Origam.Rule.IsFeatureOnFunction.Invoke(XsltContext xsltContext, Object[] args, XPathNavigator docContext) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 5416
   at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)
   --- End of inner exception stack trace ---
   at MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator)
   at System.Xml.XPath.XPathNavigator.Evaluate(XPathExpression expr, XPathNodeIterator context)
   at System.Xml.XPath.XPathNavigator.Evaluate(XPathExpression expr)
   at Origam.Rule.RuleEngine.EvaluateXPath(String xpath, Boolean isPathRelative, OrigamDataType returnDataType, XPathNavigator nav, XPathNodeIterator contextPosition) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 4348
   at Origam.Rule.RuleEngine.EvaluateRule(XPathRule rule, IXmlContainer context, XPathNodeIterator contextPosition) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 4315
   at Origam.Rule.RuleEngine.EvaluateRule(IRule rule, Object data, XPathNodeIterator contextPosition, Boolean parentIsTracing) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 2293
   --- End of inner exception stack trace ---
   at Origam.Rule.RuleEngine.EvaluateRule(IRule rule, Object data, XPathNodeIterator contextPosition, Boolean parentIsTracing) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 2338
   at Origam.Rule.RuleEngine.EvaluateRule(IRule rule, Object data, XPathNodeIterator contextPosition) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 2278
   at Origam.Rule.RuleEngine.IsRuleMatching(XmlContainer data, IRule rule, String roles, XPathNodeIterator contextPosition) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 4078
   at Origam.Rule.RuleEngine.RowLevelSecurityState(XmlContainer originalData, XmlContainer actualData, String field, CredentialType type, Guid entityId, Guid fieldId, Boolean isNewRow) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 4033
   at Origam.Rule.RuleEngine.RowLevelSecurityState(DataRow row, Object profileId, Guid formId) in D:\a\1\s\backend\Origam.Rule\RuleEngine.cs:line 3779
   at Origam.Server.SessionStore.RowStatesForDataLessSessions(String entity, Object[] ids, Object profileId) in D:\a\1\s\backend\Origam.ServerCommon\Session Stores\SessionStore.cs:line 1396
   at Origam.Server.SessionStore.RowStates(String entity, Object[] ids) in D:\a\1\s\backend\Origam.ServerCommon\Session Stores\SessionStore.cs:line 1387
   at Origam.ServerCore.ServerCoreUIService.RowStates(RowStatesInput input) in D:\a\1\s\backend\Origam.ServerCore\ServerCoreUIService.cs:line 441
   at Origam.ServerCore.Controller.UIServiceController.<>c__DisplayClass19_0.<RowStates>b__0() in D:\a\1\s\backend\Origam.ServerCore\Controller\UIServiceController.cs:line 205
   at Origam.ServerCore.Controller.AbstractController.RunWithErrorHandler(Func`1 func) in D:\a\1\s\backend\Origam.ServerCore\Controller\AbstractController.cs:line 88