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
foodrunnerfoodrunner 

Pull ID from Previous Page

I am working on a project where I have a visualforce page opening from the opportunity to pick records from the customer product custom object and copying the record into object B and referencing the opportunity page. I am trying to pull the opportunity id onto the Visualforce page. I have been scouring the discussion boards and the new. All I could file is the Janascript code to go to the previous page for IE and have been playing with some sample code.

 

 public PageReference GoBack() {
  String previousPage = System.currentPageReference().getParameters().get(​history.go(-1));
    PageReference newPage = new PageReference(previousPage);
    newPage.setRedirect(true);
    return newPage;
  }

 

I know the above code is a shot in the dark. Can anyone help and point me in the right direction?

Best Answer chosen by Admin (Salesforce Developers) 
b-Forceb-Force

pass ID in query string parameter and retrive the record on VF controller using soql

 

Thanks,

Bala

All Answers

sunil_kumarsunil_kumar

Hi foodrunner,

 

Can you explain your requirement in details?

 

After reading your post what i understand is that your whant to open an VF page from opportunity and in that you want to get opportunity id. If this is your requirement then you can pass opportunity id to VF page and then you can get it on vf page.

 

If this is your requirement then let me know?

b-Forceb-Force

pass ID in query string parameter and retrive the record on VF controller using soql

 

Thanks,

Bala

This was selected as the best answer
foodrunnerfoodrunner

I have a custom button that open's a visualforce page from a related list. The visualforce page is a search page to look up records on object b, then create a new record on object c. Att his time, all accounted for but retrieving the id from object a to the visualforce page to create the record on object c, attaching object c record to object a.

foodrunnerfoodrunner

Bala Wani,

 

I am not wanting to pass the values through the custom button as I have had problems with that before. Is there another way to do this?

foodrunnerfoodrunner

Thank you Bala Wani,

 

I was able to use the standard controller for the custom object to pass the value that I needed and have colved my problem. Thank you