Skip to main content
I am cloning Opportunity Record. When i have cloned i noticed that standard clone button was not populating on Contact record? How to self this problem. If i go for custom cloned button how to pass this Primary contact field?
1 Antwort
  1. 6. Feb. 2015, 14:38
    It seems that you are trying from a long time.... :)

    1- Create a Custom Button Type Javascript

    2- Query the Values that you want to pass to Visualforce Page

    3- Prepare URL with captured values as url parametes

    4- Get the parameter values on Controller and perform your business logic

    Here is a Sample Code for Querying values and redirecting to a visualforce page inside Custom javasc.

    {!requireScript("/soap/ajax/15.0/connection.js")}

    {!requireScript("/soap/ajax/15.0/apex.js")}

    var Contacts = sforce.connection.query("SELECT id,Name FROM Contact where opportunityid=" '{!Opportunity.Id}' "); //--- Query from Object

    records = Contacts.getArray('records');

    var val1 = records[0].FielsName;

    var val2 = records[0].FielsName;

    var URL = '/VFPage?param1='+val1+'&param2='+val2;

    window.location.href = URL;

    Copy and paste it inside Custom Button