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
dmchengdmcheng 

Opportunity: set default Close Date so user doesn't have to enter?

Hello.  I have a client who uses Opps but does not need the Close Date field, and he doesn't want to require his users to click on the date link to insert today's date since they have enough required data entry fields as it is.

I've tried using both Workflow rules and Apex to populate the CloseDate field, but it looks like the web page's field validation occurs first and returns a required-field error to the user.

Is there any way to pre-empt the web page field validation?

Thanks
David
agni.fireagni.fire
Hello,
1. Create an S Control of type URL
2. Override the new button on the opportunity with this S Control.

S-Control

/006/e?opp9={!TODAY()+90}&nooverride=1&isdtp=mn&retURL=/006/o

opp9= opp close date field that is being set. In my example, I default close date to 90 days.


dmchengdmcheng
Oh yeah, thanks for reminding me about this method of filling in a field.  This should work for us.
tmactmac

Hi angi.fire,

I am having a similar problem.  I have a set of users that want a default date but it is alittle more complicated.  They want the date to always be the end of the fiscal year which is 6/30, however the year should be 3 years from the current year.  So if they enter an opportunity today then the close date would be 6/30/2012.  Is this possible?  I have tried several formulas and it just doesnt seem to work.  I would appreciate your assistance.

AnnekeAnneke

Anyone knows how to do this with VisualForce as we can't use S-controls anymore?

dahurtdahurt

Hi, did you get an answer yet?

jdcontegixjdcontegix

This thread is pretty old, but I'll post my solution here for posterity:

 

VisualForce Code:

 

<apex:page showHeader="false" standardController="Opportunity" action="/006/e?opp9={!TODAY()+14}&nooverride=1&retURL=/006/o">
</apex:page>

 

triviewtriview

Thanks for posting a real solutions, everyone!

 

This is the only thread that I found that contains solutions for defaulting standard required field values that are enforced by standard page form validation.  Other threads that I found had incorrect responses from Salesforce Product Management directing people to use workflows. 

 

 

John Crusan 5John Crusan 5
Looks like this thread is pretty old, but incase anyone else stumbles upon it now, one good option for creating new records an auto-filling required fields is Quick Actions.

You can create them globally, or object specific. You can also indicate default field values on create, so you can get around coding and workflows.