You need to sign in to do that
Don't have an account?

How to update CloseDate on an oppertunity if StageName = "Closed Won"
Hi All,
Im new to Salesforce & Validation rules.
How do I go about creating a validation rule for an oppertunity so that it updates the CloseDate to Today when the StageName changes to "Closed Won"??
Im new to Salesforce & Validation rules.
How do I go about creating a validation rule for an oppertunity so that it updates the CloseDate to Today when the StageName changes to "Closed Won"??
You can create a workflow rule or write a trigger on Opportunity.
Workflow rule:
1. Rule criteria "created, and any "time it’s edited to subsequently meet criteria"
2. Give the rule Criteria as StageName equals Closed Won
3.create a immediate action field update for CloseDate to Today
3.Activate the Rule
Trigger:
trigger OpportunitycloseddateTrigger on Opportunity (before Insert) {
for (Opportunity opp : trigger.new)
if (opp.StageName== 'Closed Won')
{
opp.CloseDate= Date.today();
}
All Answers
You can't do this using Validation rule..
You can create a Workflow rule on Opportunity with these simple steps..
1. Rule criteria "created, and any "time it’s edited to subsequently meet criteria"
2. Give the rule Criteria as StageName equals Closed Won
3.create a immediate action field update for CloseDate
3.Activate the Rule
You can create a workflow rule or write a trigger on Opportunity.
Workflow rule:
1. Rule criteria "created, and any "time it’s edited to subsequently meet criteria"
2. Give the rule Criteria as StageName equals Closed Won
3.create a immediate action field update for CloseDate to Today
3.Activate the Rule
Trigger:
trigger OpportunitycloseddateTrigger on Opportunity (before Insert) {
for (Opportunity opp : trigger.new)
if (opp.StageName== 'Closed Won')
{
opp.CloseDate= Date.today();
}
trigger ClosedDateTrigger on Opportunity (before Insert) {
for (Opportunity opp : trigger.new)
if (opp.StageName== 'Closed Won')
{
opp.CloseDate= Date.today();
}