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
Karleen MendozaKarleen Mendoza 

Push counter not working the way I need it to

I created a workflow that increments a custom field (push counter) by 1 if the due date on a task is changed. I also created a validation rule that states if the Push Counter is greater than 3, throw out the error message.

However, when I do this, I get the Workflow Failed screen instead of the error message. How can I set this up so that the users get Error Messsage instead of the Workflow failed screen because of the validation rule the workflow won't work.  However, I want the users to see this:

Want this:
User-added image

Not this:
User-added image
Best Answer chosen by Karleen Mendoza
Karleen MendozaKarleen Mendoza
I figured this out. 

1.Set  PBilder to less than or equals number 3
2.Create an additional formula field with code:  IF(number__c = 3, 4,null)
3. Change validation rule to AND( number_1__c =4, ISCHANGED( ActivityDate ) )

This worked. Was still able to use Pbuilder to increment the push counter, and the validation rule still fired with the validation rule error screen.

 

All Answers

riyaviriyavi
Definitely needs to be implemented through a Trigger. Workflow will try to make a DML (update) which hits the validation error and cannot move forward. 
Karleen MendozaKarleen Mendoza
Yikes... that's what I feared. I have zero experience in writing Triggers, I wouldn't know where to start.
Alain CabonAlain Cabon
Hi,

Did you use the process builder or a simple field update?
 
Karleen MendozaKarleen Mendoza
I used process builder.
Karleen MendozaKarleen Mendoza
I figured this out. 

1.Set  PBilder to less than or equals number 3
2.Create an additional formula field with code:  IF(number__c = 3, 4,null)
3. Change validation rule to AND( number_1__c =4, ISCHANGED( ActivityDate ) )

This worked. Was still able to use Pbuilder to increment the push counter, and the validation rule still fired with the validation rule error screen.

 
This was selected as the best answer
Alain CabonAlain Cabon
Excellent. You should chose your answer as the best answer if your problem is solved. It is interesting because you find a smart solution (and above all, you have managed to avoid the trigger) that could help other people.