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

validation rule not working on new date field created.please help me

I create new date field on opportunity object and i want this field to be first filled by user while creating new opportunity record and then after that this field should be locked and i create the vaidation rule for this on new created fields and rule like this:

validation rule on opportunity object and here is the syntax :

ISCHANGED( Original_Close_Date__c ), 
NOT( ISBLANK( PRIORVALUE( Original_Close_Date__c ) ) ) 

But when i test as user then i am still able to change the new field on already creted record..
any idea please help me


I never saw a reply to my last follow up on this same question over in Answers, but can you confirm that the Original Close Date field had a date in it before you edited the field?


Also, is your main goal just to capture the original date entered into the Close Date field when the Opportunity is first created? Do you have Enterprise or Unlimited Edition? If so, it would be easier to just create a workflow rule to enter the first Close Date value into the field upon creation of the Opportunity, and make the Original Date Field read only. This removes any need for a user to manually do anything with the Original Close Date field.


Just in case someone finds this question and doesn't see the solution on Answers, here is the solution:


    ISCHANGED( Original_Close_Date__c ), 
    NOT( ISBLANK( PRIORVALUE( Original_Close_Date__c ) ) ) 


please find my answer blow: 1. yes,the Original Close Date field had a date in it before you edited the field. 2.. the goal is to keep track that how many time user change the close date and the new filed which Original Close Date should be eidtable when user creating new record and after saving the record, Original Close Date filed should be read only field so user cannot change date on Original Close Date. 3.Unlimited Edition 4. could you please me that how i need to create workflow that you describe in deatil because i am new to salesforce and i dont know that how to create workflow like you explain. thanks

Ok,now we are getting somewhere. Lets get this over with by writing a workflow rule.


1. Make the Original Close Date field Read Only (at the field level, so it is always Read Only).
Note: You, as a system administrator WILL be able to edit it because you can edit all Read Only fields except for Formula fields.


2. Create a new workflow rule by clicking Your Name > Setup > Create > Workflows & Approvals > Workflow Rules

Object: Opportunity

Name the Rule

Evaluation Criteria: "created"

Run Criteria: Opportunity:Created Date not equal to __________ (leave Value field blank)

Click Save & Next


3. Add Workflow Action - New Field Update.

Name the Field Update

Select Field to Update: Original Close Date

Select "Use a formula to set the new value"

Enter into the formula bar: CloseDate

Click Save.

Click Done.

Make sure to click the Activate button on the workflow rule.