
1 réponse

It seems that you are trying from a long time.... :)1- Create a Custom Button Type Javascript2- Query the Values that you want to pass to Visualforce Page3- Prepare URL with captured values as url parametes4- 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+'¶m2='+val2;
window.location.href = URL;
Copy and paste it inside Custom Button