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
kperrikperri 

Validattion rule help to have a date field required when another field is updated.

I am trying to build a validation rule that will require a date when 1 of 3 fields are updated.  Initially I did

AND(
Asset_Update_Date__c = PRIORVALUE(Asset_Update_Date__c),
OR(
ISCHANGED( Unmanaged_Muni_Assets__c ),
ISCHANGED( A_Share_Assets__c ),
ISCHANGED( C_Share_Assets__c  )))

 

That only works if a date is already in the field. 

 

These fields will initially start off blank as will the date.  What I would like to see happen is when a user updates any of the fields that it requires the Asset_Update_Date field to be updated to the current date.

 

Thanks

Noam.dganiNoam.dgani

AND(
ISBLANK(Asset_Update_Date__c),
OR(
ISCHANGED( Unmanaged_Muni_Assets__c ),
ISCHANGED( A_Share_Assets__c ),
ISCHANGED( C_Share_Assets__c )
)

Shailesh DeshpandeShailesh Deshpande
Try changing the first condition to:

ANd(

OR(
ISBLANK(Asset_Update_Date__c),
Asset_update_Date__c == PRIORVALUE(Asset_Update_Date__c)
),

REST OF THE FORMULA,

Asset_Update_Date__c <> Today()
)
kperrikperri

Thanks for the reply.  Is there a way for the rule to look at the Asset Update Date and if that date is not equal to today, that it be required to be updated to today?

 

Additionally, changing the rule as indicated wouldn't require a date change of the Asset Update Date.  I am trying to get it where if any of the 3 fields are updated that the Asset Update Date be filled with the current date. 

kperrikperri

This worked I think.  Thanks I am trying to wrap my brain around these validation rules as a new admin.

 

Thanks

Shailesh DeshpandeShailesh Deshpande
I just noticed that you dont even need to check the PRIORVALUE of the date field, if you want to make sure that the date is equal to today. SO, This is how your formula should actually be:

ANd(

ISCHANGED() functions of the three fields,

Asset_Update_Date__c <> TODAY()
)

CHECK IF Any of THE FIELDS ARE CHANGED,
If yes, check if Asset_update_Date__c is equal to today.
kperrikperri

I ran into an issue with the validation rule.  When updating any of the fields the Asset Update Date will not accept todays date. 

kperrikperri

So I created the below validation. (I added an additional field I needed.

AND(
ISCHANGED( A_Share_Assets__c , C_Share_Assets__c , FA_s_Total_AUM__c , Unmanaged_Muni_Assets__c ),

Asset_Update_Date__c <> TODAY()
)

CHECK IF Any of THE FIELDS ARE CHANGED,
If yes, check if Asset_update_Date__c is equal to today.

 

When clicking Check Syntax I get an error Extra Check

Shailesh DeshpandeShailesh Deshpande
It should be:

AND(

OR(
ISchanged(A_Assets__C),
ISCHANGED(C_Assets__c),
ISCHANGED(FA_Total_AUM__C),
ISCHANGED(Unmanaged_Muni_Asset__c)),

Asset_Update_Date__c <> TODAY()

)


kperrikperri

What about the

CHECK IF Any of THE FIELDS ARE CHANGED,
If yes, check if Asset_update_Date__c is equal to today.

 

That was in your previous post.

 

Thanks

 

Shailesh DeshpandeShailesh Deshpande
Ohhh..you pasted that too? It was just the logic that I wrote for you to understand what the formula is doing..it was not supposed to be included in the actual formula.
kperrikperri

Thanks for all you help on this.  This is getting closer.  Now it will require today's date, if it isn't already.  However, it doesn't give you the error if there is currently no date listed. 

 

From day 1 all fields will be blank (including the date field)  Users will begin to populate those fields at which point I would want them to be required to enter a date.  I thought that ischanged would compare a blank field to a new number.  It appears ischanged is only working if there is a number there and it is changed.  So how can you make the rule fire when it goes from blank to a number?