Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Business Rule conflict

Hi - I have 2 business rules that run after a button is clicked. Both are triggered on a Update with the same Command Argument.

One is an SQL rule (Before Phase) that validates that 2 fields are populated and if so changea status field, otherwise it displays a message and stops processing.

The other rule is an Email rule (After phase) that sends a simpe notification to the user.

The problem is that if the validation doesn't work the second rule still executes. How do I stop that? In the first rule (the validation rule) I don't set Prevent_Default=1 because I found that when I did that it didn't behave as required. Not sure if that has anything to do with the second rule running.

Thanks.
1 person has
this question
+1
Reply
  • Hi Tom,

    By not setting Prevent_Default to 1, presumably it's not stopping processing which is why the 2nd rule executes.
    If you don't want to set Prevent_Default to 1 you could check if the 2 fields have been populated at the start of the Email rule and only send the email if they have.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • I'll give you the context for not setting PD to 1. When the user clicks the button it checks for certain values. If they're OK, it changes the status which is controlled using buttons and not by allowing the user to change a lookup. If they're not there it displays a message. Then the user can just click on edit and make some changes and then save. They would then have to open the item and click the button to move it on. I've found that clicking Save makes the changes that were intended if that validation passed anyway (i.e. the status change) even though the user wouldn't have clicked the button. This doesn't happen with PD not set. Here is the rule:

    -- perform validation
    if @QuotedPrice is null
    begin
    --set @BusinessRules_PreventDefault = 1
    set @Result_ShowViewMessage = '--Display error message--.'
    set @Result_Focus = '-- Display message--'
    end
    else
    begin
    select @StatusID = Statuses.StatusID
    from Statuses
    where Sequence=3

    end
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited