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
parsa033parsa033 

S-Control to create a new Opportunity

I want to create a button that creates an opportunity with defined fields. This is what I got so far:
 
window.parent.location.href="{!URLFOR($Action.Opportunity.New
,Opportunity.Id, [opp4= Account.Name, opp3="ProductName -  "&Account.Name, opp7= "555", opp9= TEXT(MONTH(Today()+7))&"/"&TEXT(DAY(Today()+7))&"/"&TEXT(YEAR(Today()+7)) , opp11="Qualified Lead",p3="012500000009CJ7"])};"
 
This works. it takes me to the opportunity creation page though with all the fields that are defined filled up, but I have to still click on the create buttons.
 
Is there a way that I can do this and make it automatically create the opportunity and send me to the opportunity page rather than showing me the create form all over again.
BRupholdtBRupholdt

OK, I'm no expert so I can't guarantee my answers but when using the same method to edit an opportunity automatically, you append ",save=1" to the end of the field to force an auto-save.  I would guess that the same will work when creating an Opp.  That makes your URL look like this:

window.parent.location.href="{!URLFOR($Action.Opportunity.New
,Opportunity.Id, [opp4= Account.Name, opp3="ProductName -  "&Account.Name, opp7= "555", opp9= TEXT(MONTH(Today()+7))&"/"&TEXT(DAY(Today()+7))&"/"&TEXT(YEAR(Today()+7)) , opp11="Qualified Lead",p3="012500000009CJ7,save=1"])};"