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
Mitchell McLaughlin 1Mitchell McLaughlin 1 

Going to Visualforce Page through custom buttons with passing parameters

Hi -

I am trying to navigate to a visual force page, while passing parameters through the URL. Here is what it is without javascript, using the Display in existing window without sidebar or header via URL option.
/apex/QuoteRequestDetailsPage?OpportunitySegmentId={!Opportunity_Segment__c.Id}

I'd like to put this into javascript and add criteria on WHEN we allow people to navigate to this visual force page.

Here's my best try but i'm getting an error:

string url = "/apex/RFPDetailsPage?OpportunitySegmentId="+{!Opportunity_Segment__c.Id}+"&
OpportunityId="+{!Opportunity_Segment__c.Opportunity_ID__c};

window.location.href=url;

 
sandeep@Salesforcesandeep@Salesforce
Hi Mitchell, 

Please try as below 
window.open('/apex/RFPDetailsPage?OpportunitySegmentId=+{!Opportunity_Segment__c.Id}+&
OpportunityId=+{!Opportunity_Segment__c.Opportunity_ID__c}');

If it resolves your problem then please mark this as best answer.

Thanks 
Sandeep Singhal
http://www.codespokes.com/
 
Mitchell McLaughlin 1Mitchell McLaughlin 1
Hi - i got invalid token error.
sandeep@Salesforcesandeep@Salesforce
Hi Mitchell,
Please try this. 

window.open('/apex/RFPDetailsPage?OpportunitySegmentId={!Opportunity_Segment__c.Id}'+'&OpportunityId=+{!Opportunity_Segment__c.Opportunity_ID__c}');

Thanks 
Sandeep Singhal
http://www.codespokes.com/
Mitchell McLaughlin 1Mitchell McLaughlin 1
Works like a charm. Thank you buddy.
sandeep@Salesforcesandeep@Salesforce
Hi Mitchell,

Glad to know that solution helped you. Please mark my answer as best answer so that it will be helpful for others. 

Thanks
Sandeep Singhal