0

Have a link that calls a VF page for a user to fill in required fields then create a Test Record. The VF page is in a pop up window.

When the Test__C is created I want the parent window to redirect to the newly created Record.

Everything works except closing the pop-up and redirecting the parent window.

5
  • Just a thought, I typically avoid using popups. Users typically don't like them and managing the interaction between windows is a pain. Why not just have the link open in the current window? – Ralph Callaway Dec 19 '13 at 6:03
  • This is a My client requirement. Thats why we are using this. Please suggest me. – R.Malla Dec 19 '13 at 6:13
  • is the parent a detail page or another vfpage – Prady Dec 19 '13 at 6:15
  • This could be of help boards.developerforce.com/t5/forums/forumtopicprintpage/… – Prady Dec 19 '13 at 6:19
  • Its another visualforce page but it having view of that record – R.Malla Dec 19 '13 at 6:29
1

I would suggest you not using a popup at all, instead use a modal popup which basically is a outputpanel in the parent VF page which is rendered as and when you want to show it.

You could very easily call any page using the page reference method. With this solution you dont need to worry about popup blockers blocking popups.

A detailed explanation of the code can be found in http://www.tehnrd.com/visualforce-pop-up/

1
  • That is ok for show and hide. But my case is different. When the Test__C is created I want the parent window to redirect to the newly created Record. Right now it is redirecting to direct to another page but i want to redirect to the newly created Record. – R.Malla Dec 19 '13 at 7:03
0

In your VF page controller method when your record is created successfully then you cna add below code for redirecting it to newly created record :

PageReference ref = new PageReference('/'+ test__c.Id);
ref.setRedirect(true);
return ref;

And before that onclick of the save button you can call one javascript line :

window.close();

After this call controller method and use the PageReference code whioch will redirect you to the newly created record screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.