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

Opportunity to Contract Data with New Contract
I want to transfer the data from opportunity to contract.
I had created CREATE CONTRACT button at opportunity page.
Now my requirement is that: Once opportunity will create and saved and user click on the CREATE CONTRACT button.
It will create a new contract for the same opportunity and pass all the field data from opportunity to contract.
So how can achieve this task (By Trigger, Classes or VF)
I had created CREATE CONTRACT button at opportunity page.
Now my requirement is that: Once opportunity will create and saved and user click on the CREATE CONTRACT button.
It will create a new contract for the same opportunity and pass all the field data from opportunity to contract.
So how can achieve this task (By Trigger, Classes or VF)
You can create a Visualforce page where the StandardController is Opportunity. Having that, you can got to Opportunity object and create a button similar to this one:
Then the page can show Contract fields populated with Opportunity data. Doing in this way, you offer the end use the option to modify values if they want. But in order to do that you also need a Controller.
In the Controller I would create a inner class with all Contract information. Then you can pre-populate it with Opportunity information. Finally Use the inner class to show the fields in the page.
The last step is the save button, Quite easy, use the fields data.
Find bellow an example with a single field. You can extend it and add all data you need and also changes look and feel.
VisualforcePage
Controller
Hope this helps
All Answers
1. Do not create a button and create a Trigger related to Opportunity. And clicking on Save button, a new Contract will be created with the Opportunity information. Something like this.
But this mean to keep 2 things in mind:
- What about if you update the opportunity? Do you want to modify the existing and related Contract? Then you would need to add the after update as well.
- The new Contract is created behind the scene, so that you cannot navigate directly to the new Contract.
2. Create a button and link it to a visualforce page with a controller. This will allow you to navigate to the new Contract when the action is done, but what about if the end user forget to click on the button after creating the Opportunity?
Both options are good. Actually the decition depends on requirements.
Hope this helps.
I am looking for the (2) - option, that fulfill my requirement.
Req: Need to create the NEW CONTRACT button. once opportunity will create, user will click on the Button on that based CONTRACT will create.
Now I want to transfer all the record field data into the newly created Contract
You can create a Visualforce page where the StandardController is Opportunity. Having that, you can got to Opportunity object and create a button similar to this one:
Then the page can show Contract fields populated with Opportunity data. Doing in this way, you offer the end use the option to modify values if they want. But in order to do that you also need a Controller.
In the Controller I would create a inner class with all Contract information. Then you can pre-populate it with Opportunity information. Finally Use the inner class to show the fields in the page.
The last step is the save button, Quite easy, use the fields data.
Find bellow an example with a single field. You can extend it and add all data you need and also changes look and feel.
VisualforcePage
Controller
Hope this helps