Issue while using rule parameter - Rule not compiling #304
Answered
by
WithAnOrchid
ArvindLakra
asked this question in
Q&A
|
Hello, I am trying to use Rule engine. However, keep running into issues like below - Input workflow : - [
{
"WorkflowName": "ClientRules",
"GlobalParams": [
{
"Name": "SamePrimaryDomain",
"Expression": "HelperUtils.CompareDomains(\"abc.domain.com\", \"abc.domain1.com\")"
}
],
"Rules": [
{
"RuleName": "SameDomain",
"properties": {
"RuleId": "1"
},
"SuccessEvent": "1",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "SamePrimaryDomain == true "
},
{
"RuleName": "Region",
"properties": {
"RuleId": "2"
},
"SuccessEvent": "2",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "client.filterRegion.regionId == inputClient.region.regionId"
},
{
"RuleName": "RegionWithCountry",
"LocalParams": [
{
"Name": "localFunction",
"Expression": "client.forceCountry == true OR client.filterCountry == inputClient.locationcountry"
}
],
"properties": {
"RuleId": "3"
},
"SuccessEvent": "3",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "RegionWithCountry == true"
}
]
}
]While 2 rule parameter passed are -
{"forceCountry":true,"filterCountry":"Country 4","forceRegion":false,"forceDomain":false,"filterRegion":{"regionId":3,"regionName":"Region 3"},"client":{"hostName":"sampleClient.sample2.subdomain1.com","clientId":119,"clientName":"client"}}-- This is item 2 {"client":{"hostName":"1.sample1.com","clientId":1,"clientName":"Client Name 1"},"location":{"country":"Country 1","countrycode":"1"},"region":{"regionId":1,"regionName":"Region Name 1"}}bre.ExecuteAllRulesAsync("ClientRules", rp1, new RuleParameter("inputClient", x.Item2)).Result |
Answered by
WithAnOrchid
Feb 17, 2022
Replies: 1 comment 1 reply
|
Try add your Enum type to ReSettings, then pass ReSettings to RulesEngine constructor |
1 reply
Answer selected by
abbasc52
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try add your Enum type to ReSettings, then pass ReSettings to RulesEngine constructor