Search code examples
c#collectionsenumsbusiness-rulescodeeffects

CodeEffects RuleEditor doesn't display enum values if they are stored in a list


I have updated the code effects angular code example with a property on Patient that contains a list of enums

    [Field(DisplayName = "Favorite food", Description = "The patient's favorite food")]
    public List<Food> FavoriteFood { get; set; }

Where the Food enum looks like:

    public enum Food
    {
        Sandwich = 0,
        Apple = 1,
        Banana = 2,
        Noodles = 3,
        Candy = 4
    }

When I create an execution rule that checks if the food list contains certain items, the values aren't displayed in the rule when the rule is saved.

My rule looks like this

And the way this is sent to the controller on save is:

If Favorite food contain  and Favorite food do not contain  then Register with a Message ("Give&nbsp;apples&nbsp;instead&nbsp;of&nbsp;bananas")

The rule xml is saved correctly and works as expected. We want to use the rule text as the description. How can we achieve this?


Solution

  • Please use the latest version of the Code Effects rule editor's script available here. This should fix the inability of your editor to load/display values of the enums.

    The decoded values in string params are a known issue and it's going to be addressed in the next minor version due for release next week.