URL hacking to auto populate fields on click of button

Hi Developers !!. This post is regarding the  Custom Button  on Opportunity Object which  will help us to create cloned opportunities and auto populate fields with its Line items with the help of URL hacking 

Please follow the below steps:

1. Go to setup.
2. Create new detail page button on Opportunity object.
3. Give the Label for button.
4. Set behavior as 'Execute JavaScript' and Content Source as 'OnClick JavaScript' .

Paste the below snippet of code in your window.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
var  urlhack = "{!URLFOR( $Action.Opportunity.Clone , Opportunity.Id, [cloneli=1,opp11='Unqualified',CFID (Give id of the custom field)=Opportunity.Name])}"; 
window.open(urlhack);


5. Go to opportunity layout and add new button in the layout.


Comments

Post a Comment

Popular posts from this blog

Test-Driven Development in Salesforce

Setting a default 'From' address when sending an email from Cases

Email Messaging from Salesforce