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
Henrik HeltHenrik Helt 

Validate if a Task Due Date < Opportunity Close Date

Validate Opportunity Close Date > Task Due Date when saving a task?

  • I want to be able to validate if the due date on a Task associated to an opportunity is valid, it means that the Task Due Date has to me less than Opprotunity Close Date. It should not be possible to create a new task which Due Date is greater than the Opportunity Close Date.
  • When creating a new Task and selecting a Task Due Date and pressing Save I want Salesforce to validate if Due Date < Opportunity Close Date. If the validation return FALSE an errormessage has to pop up telling you have to eighter change the Task Due Date or the Opprotunity Close Date.

 

If possible I would like to make a validation directly on Due Date and Close Date, but it is not possible to make that validation as far as I can figure out.

 

Anybody out there who already has an solution?  

Thanks a lot. 

netTrekker_ADnetTrekker_AD

Im not finding a way for a validation rule to achieve this.  Despite the fact that the task is related to the Opportunity, Salesforce does not recognize Opportunity fields under Task validation rules, other than ID.

apex whistlerapex whistler

If you don't mind getting you hands dirty with Apex coding, then you can create a trigger that checks for the condition you've specified before inserts and updates. Unfortunately, the Opportunity object is not accessible from the Task object and vice versa via validation and workflow rules.