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
Waqas AliWaqas Ali 

New to Sales force. - Convert Opportunity to Contract

I am totaly new to salesforce, want to do this. 
- Create a Button on Opportunity Details Page.
- Write the code to convert Opportunity to a Contract and Order, when the button is pressed.

I am realy confused how to start ? I am unable to find a solution.  I am hoping that someone here has the knowledge on how to accomplish this.  Thank in advance for your time and help

Best Answer chosen by Waqas Ali
Ajay K DubediAjay K Dubedi
Hey Waqas ,
You can use a custom button on the Opportunity object which creates a new Contract and pre-populates the fields you want (including the Opp). 
This is done by an unofficial technique called 'URL-hacking' where your custom button just puts the field values on the 'new Contract' URL.
I collected this answer from (  https://success.salesforce.com/answers?id=90630000000glYEAAY ) answered by Jeff May and 
my second suggestion is to write a trigger as per this link ( http://salesforce.stackexchange.com/questions/23420/convert-opportunity-into-contract) and move this whole logic into a method of  class if you are done with this you can call a class method from onclick javascript provided by salesforce I think this will solve your issue.