Replies: 1 comment 1 reply
-
Why not create public property inside input1 class object to retrieve the Id? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to define a rule with a Custom Action that evaluates an input field in the json and performs some operation on that field.
Here's an example of what I'm trying to do:
Given this input json
{ "Data": { "BaseData": { "Content": [ { "Id": "product001/sku111/id009", "TargetItemId": "BuyButton" } ] } } }
I want to transform the Id field Data.BaseData.Content[0].Id to just contain product001 by splitting the string.
Here's what my rule looks like:
{ "RuleName": "SetProductId", "SuccessEvent": "GiftPurchase", "ErrorMessage": "Failed to set purchase flow to Gift.", "ErrorType": "Error", "RuleExpressionType": "LambdaExpression", "Expression": "1 == 1", "Actions": { "OnSuccess": { "Name": "CustomAction", "Context": { "customContextInput": "input1.Data.BaseData.Content[0].Id" } } } }
Here's the Custom Action defined by me:
`public class CustomAction : ActionBase
{
private readonly RuleExpressionParser _ruleExpressionParser;
}`
When running the rule evaluation I get the following error:
Expression of type 'System.Object' cannot be used for return type 'System.String'
Beta Was this translation helpful? Give feedback.
All reactions