+ Start a Discussion
imAkashGargimAkashGarg 

[URGENT]: Pass variable over standard pages

i have to pass one variable on click of a custom button on standard page. The button will lead to new oppty page. here, on the opportunity i want to save the variable's value to one of the oppty field.

i tried using to send over url but i was unable to fetch that value on oppty.

please let me know what are the other options to pass variables on standard page.

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Pagereference won't work for standard pages.

 

Making the button target a URL and passing the parameters on the URL is the correct way to do this (although its unsupported, so there is no guarantee this will work with future releases).

 

Check out this blog post (not mine) which has a detailed discussion of how this works:

 

http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

All Answers

Vinit_KumarVinit_Kumar

Aakash,

 

You can use Pagereference class.Please find below the link for the same :-

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_pagereference.htm

 

 

bob_buzzardbob_buzzard

Pagereference won't work for standard pages.

 

Making the button target a URL and passing the parameters on the URL is the correct way to do this (although its unsupported, so there is no guarantee this will work with future releases).

 

Check out this blog post (not mine) which has a detailed discussion of how this works:

 

http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

This was selected as the best answer
imAkashGargimAkashGarg

Super!

Thanks for the response.... exactly what i was looking for!

 

i have added a custom setting to avoid hard coding and to be able to deploy to production.

The field to which we are storing the value from URL should be present on the page layout.

Can we make it hidden, i mean i dont want it on the page layout, it is just used for getting the value, can that field be removed from the layout???

bob_buzzardbob_buzzard
No, you don't have the concept of hidden fields on a standard page layout. If the field isn't on the page layout, there won't be an HTML input to capture the data. You might be able to do something using some javascript in a sidebar component, but that would be unsupported and could break at any time. I usually hide these sort of fields down in the System Information section and give them 'system' sounding names.
imAkashGargimAkashGarg

Thanks.