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
picnichousepicnichouse 

Help with a simple custom button?

Hi,

 

I was hoping someone could help me create a custom button for my opportunity detail layout (SF professional).  Here's what I need it to do:

 

* Set the Opportunity to Closed Won

* Set the Close Date to 2/2/2222

* Set the custom field Win Date to TODAY

 

I've never done any of this stuff before so I'm not sure where to start.  For example, should I use javascript, a visualforce page, or an s-control? 

 

Any help would be much appreciated!

 

Andrew 

werewolfwerewolf

That's very similar to this:

 

http://blogs.salesforce.com/support/2008/07/the-quick-case.html

 

In that example it's setting the case status to Closed, but the concept is nearly the same.  You'll want to change it to edit an Opportunity instead, and set something like

 

opp.Win_Date__c = new Date();

 

(that will set it to be today)

 

 

picnichousepicnichouse

Cool - except I'm getting this error:

 

A problem with the OnClick JavaScript for this button or link was encountered:

 

{faultcode:'sf:API_DISABLED_FOR_ORG', faultstring:'API_DISABLED_FOR_ORG: API is not enabled for this Organization or Partner', detail:{UnexpectedErrorFault:{exceptionCode:'API_DISABLED_FOR_ORG', exceptionMessage:'API is not enabled for this Organization or Partner', }, }, line:'1019', expressionBeginOffset:'29196', expressionEndOffset:'29212', sourceId:'1106863424', sourceURL:'https://na6.salesforce.com/soap/ajax/13.0/connection.js', }

 

How do I enable the API?  I have Professional edition. 

werewolfwerewolf
Well that's unfortunate.  The API is something you have to pay for, either by getting the API addon for PE or by upgrading to EE.  I don't think there's any other way to do what you want to do.