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
Sarah OsburnSarah Osburn 

validation rule that prevents users from activating a contract

I'd like to leverage out of the box contracts but I need to prevent users from activating a contract unless 2 date fields are not blank
Sarah OsburnSarah Osburn
Current rule is:

AND(
ISPICKVAL( Status,"Active"),
ISBLANK( CompanySignedDate ),
ISBLANK( CustomerSignedDate ))
Jason Curtis NBSFDGJason Curtis NBSFDG
Hi, Sarah, I created a validation rule on Contracts with your login, I changed ISPICKVAL for Status to "Activated" instead of Active (that was the default value in my dev org) and I got a validation error message (see below, not that pretty unfortunatetly). Your logic as it stands though will only work if both date fields are empty (i.e. if one was filled out but not another the contract would activate), if you want it to require both to be filled out before activation, this works:
AND(
ISPICKVAL( Status,"Activated"),OR(
ISBLANK( CompanySignedDate ),
ISBLANK( CustomerSignedDate )))

User-added image
Hope this helps.
Sarah OsburnSarah Osburn
Hi Jason,

I can't get  validation to work.  I am pretty sure that the Activate button is messing with my status.  I think the activate button action happens after the status change....????  Instead I created a custom 'Status' button and removed the button from the page layout.

Thanks for your quick response!!
Jason Curtis NBSFDGJason Curtis NBSFDG
Did you create your own "Status" button or a new "Status" field? The formula you posted (and the one I modified) worked off of the standard Status field on the object. If you are using a different field it will have a API name like Status__c. The test I ran with the default Activate button worked well with the modified validation rule.