locked
Bug/limitation in Business Rules and Domain Based Attribute RRS feed

  • Question

  • I have read the other threads related to business rules and DBA's and yet it seems that this is distinct case.

    I believe that combining a rule "Defaults to" / "Defaults to concatenated value" and "Is Required" leads to incorrect results. Let me explain in detail:

    1. Have a DBA X in any entity. 

    2. Create a business rule, X is required.

    3. Create a business rule, X defaults to  a value that does not resolve to a correct member

    For example, X is DBA to entity Y; Y has codes 01, 02 and 03. Set the business rule to e.g. 04

    DBA = Domain Based Attribute

    When you validate the members, you will that even though attribute X is empty, the validation still succeeds, and the member is marked as valid, which is incorrect.

    I examined a little bit the stored procedure generated by the business rules, and it seems that for applying the "Is Required" even the temporary value set to the attribute (here '04') is sufficient to consider it "Not Blank", and this is the culprit. In other words, the "Is Required" business rule is applied before the value assigned to the DBA is resolved to an existing member.

    Could anyone confirm this behavior?

    The only workaround I have found is to change the "Is Required" business rule to "Is not Valid", and in Conditions, use DBA.[X].Code is Blank.

    Note: members with status "Valid" or "Invalid" are excluded from Business Rule processing! This means that the members incorrectly marked as Invalid can only be forced to validate if one attribute has changed, or if one business rule has changed. 


    Half Scheidl


    • Edited by Half A Monday, July 8, 2013 3:46 PM Added a note about BR processing
    Thursday, June 6, 2013 6:16 PM

Answers

  • Wednesday, June 12, 2013 7:10 PM
  • In other words, the "Is Required" business rule is applied before the value assigned to the DBA is resolved to an existing member.

    Have you tried changing to priority of the business rules in such a way that Is Required business rule has either a lower or higher priority than the business rule that sets the value to an incorrect member?

    Kind regards,

    M

    P.S.: The bit that worries me more is that it seems as if you managed to write a rule that sets a Domain Based Attribute to a value invalid. If I read this correctly, this is a serious referential integrity problem.

    Thursday, June 13, 2013 7:49 AM
  • "P.S.: The bit that worries me more is that it seems as if you managed to write a rule that sets a Domain Based Attribute to a value invalid. If I read this correctly, this is a serious referential integrity problem."

    The value is not persisted; the Business Rule of type "concatenation" resolves to a string which is not equal to a code from the DBA. So the problem is: member are incorrectly reported as  "Invalid" or "Invalid".


    Half Scheidl

    Monday, July 8, 2013 3:44 PM

All replies

  • Wednesday, June 12, 2013 7:10 PM
  • In other words, the "Is Required" business rule is applied before the value assigned to the DBA is resolved to an existing member.

    Have you tried changing to priority of the business rules in such a way that Is Required business rule has either a lower or higher priority than the business rule that sets the value to an incorrect member?

    Kind regards,

    M

    P.S.: The bit that worries me more is that it seems as if you managed to write a rule that sets a Domain Based Attribute to a value invalid. If I read this correctly, this is a serious referential integrity problem.

    Thursday, June 13, 2013 7:49 AM
  • The "Is Required" business rules is always executed after "Set Value", regardless of priority. 

    http://msdn.microsoft.com/en-us/library/ff487015.aspx

    "You can set priority order for rules to run in. However, before priority is taken into account, business rules are applied based on the type of action the rule takes. The order is as follows:

    1. Default Value

    2. Change Value

    3. Validation

    4. External Action"


    Half Scheidl

    Monday, July 8, 2013 3:40 PM
  • "P.S.: The bit that worries me more is that it seems as if you managed to write a rule that sets a Domain Based Attribute to a value invalid. If I read this correctly, this is a serious referential integrity problem."

    The value is not persisted; the Business Rule of type "concatenation" resolves to a string which is not equal to a code from the DBA. So the problem is: member are incorrectly reported as  "Invalid" or "Invalid".


    Half Scheidl

    Monday, July 8, 2013 3:44 PM