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
Nitin Kapoor 15Nitin Kapoor 15 

Workflow field update in same transaction

I am trying to figure out whether we can set a date field to todays date if its NULL. When the user moves the status to ‘complete’ I’d like to give them the option to enter an XYZ date, and if they don’t then this field should be filled with today’s date.  I have created a workflow rule that does most, but not all of this.
The workflow rule successfully pushes todays date if the field is null, however if the user pressed ‘edit’ and changes the Status as "Complete" along with adding an XYZ date all in the same ‘edit’ action, the date they enter is overwritten with “today”.  I need to accept the entered value and not overwrite it.  Is this possible using workflow or process builder. I know I can do it using the trigger but I want to avoid writing a trigger?
Ajay K DubediAjay K Dubedi
Hi Nitin,

There is a small and easy alternative for this if you want the date to be default as TODAY.
You can just provide a default value of the field as TODAY().
custom date

P.S- This will not keep the date field as null. 
Or, try changing the criteria of Workflow to:
OR(IsNull(dateField), IsBlank(dateField))

Hope this helps!

Thank you,
Ajay Dubedi

Kakasaheb EKKakasaheb EK
Hi Nitin,
I would suggest below solutions for this business case - 
1. Create Workflow rule and set evalutation criteria as 'Created'
2. As default set today's date in field update action - as you already done 
3. After that create validation rule and add the condition as status to ‘complete’ then only user can change the date.

I hope it will definitely help you.