function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brian KakuBrian Kaku 

Amount field can not be blank

I have a workflow rule that sums 4 different fields and then updates the Amount field.   I would like to add a validation rule that says the Amount field can't be blank if the Stage is beyond Tracking.   Since the validation rule fires before the workflow rule, it is always sending the Error Message.   I tried to use the OR statement for each of the fields, but it did not work.  Any Ideas?
Sindhu1234Sindhu1234
If you want the message to be fired after the workflow rule then replace the workflow  with trigger. In the trigger you can add the 4 fields and display the amount and even you can check if the amount is null then display an error.
Brian KakuBrian Kaku
Hi sindhu,

Sorry, i'm a newbie at this.   i'm trying to understand how the trigger would sum the 4 fields and update the Amount field.    Can you give me an example?
 
Kevin Malek 16Kevin Malek 16
If I am understanding your problem correctly, if any of the four fields in the summary contain a value it will populate the Amount field.  Change the validation rule logic from OR to AND.  If all four fields are summarizing into the Amount, ALL of them cannot be blank. Using OR just looks if any one of them are blank.  
Brian KakuBrian Kaku
Hi Kevin, thanks for the quick reply.  the problem that I am having is that the validation rule fires before the workflow rule.   So if any of the fields are blank. the validation rule sends the error message, which is perfect.   The problem is that the user will then go in and update any or all of the four fields but when they go to save it, the validation rule fires before the workflow rule so the Amount field never gets updated and error message shows up again
Kevin Malek 16Kevin Malek 16
Hmmmm.  In that case I would default a "0" in the Amount field as a placeholder when the record is created if there is no other value present.  The placeholder value will satisfy the validation rules (with a given you are not validating against that either). You can do this with a field update upon record creation. You may have to update existing records with a blank Amount value to $0. I know, it's a work around but will help users moving forward.