You need to sign in to do that
Don't have an account?
Record creation re-render tabbed VF page
Hey there,
I am not even sure this is possible, but I need some advice. Basically, I have a tabbed VF page for my account and all of its related lists and child objects have their own tab. These tabs are lists of all the records associated with that account and should the user click on one of the links, the bottom half of that tab will re-render with the information. Essentially, it is all the information on one page.
This all works perfectly, except what i need to do is to make it so that should the user wish to create a new record, upon saving they will be re-directed to the tab of the object they had jsut created the record in. I have searched and searched and searched for a solution, many people have theories on how to do this...maybe some people have even done this (by searching for a reference for each tab or naming each tab in the code), however it is a bit beyond my coding skill.
My question is...Would it be possible to have a link which will re-render the bottom half of the tab..into a create new record VF page...which upon saving will once again re-render to the record... What are your thoughts people?
Mikie
1. If you just put FactFinder in the selectedTab parameter of the tabPanel does it start on the FactFinder tab? If not, there's something wrong with that page and you'll need to figure out what is not working.
2. If that works, then double check that the formula I gave you is working. Just paste it somewhere on the page that's not inside of a paramter and test it. It should display AccountDetail unless you come from your FactFinder submission page.
All Answers
First off, be careful because a page with this many forms and DML statements may have issues with limits in the future.
However, I don't see why you couldn't do this. You could probably use rerender and rendered values to show and hide the sections without causing a page referesh. However, if you want to figure out how to go to different tabs, just use the selectedtab parameter in the tabpanel.
Then in your controller, get the selectedtab from the URL
So when you're saving the records from your form for creating records, you just need to append the tab name to the URL parameters of the pagereference that is returned.
Hey Paul,
Thank you for the quick reply. I have begun writing a record creation page for my custom object 'Fact Finder' and an extension (with alot of help from people on the forums) to add to my Tabbed Accounts VF page. I was wondering if you would be able to give me a little hand on how I may implement the code that you have just posted? This is my Fact Finder, record creation page:
This is my extension, it currently redirects to the TestAccount VF page:
This is the main Accounts tabbed VF page with the Fact Finder section highlighted
Any help would be much appreciated. I was also wondering what you mean by issues with limits in the future? Is it possible to avoid these issues if the code is written solidly enough... Basically, the goal is to have people redirected to the open tab after creating a record and the rendered record creation on the page is the dream that I only found out was possible after reading your post just now...But is way in the future.
Please let me know your thoughts.
Thankyou for your time
Mikie
Update saveFactFinder method
Then in myfactfinderextension2 which you didn't post, add the method I posted earlier for getting the tab from the parameters.
Then in the visualforce page, use the selectedtab merge field that I also mentioned before.
That is an old extension for something different, it should not still be there..Do I have to just create another extension? I am not too good on this, apart from the method, what else will the extension need? Or is the method you posted earlier enough?
You can try doing this in the selectedtab parameter for your tabpanel component in the visualforce page then:
I think that's the right formula but I haven't tested it.
It all saves fine when editing the code, but then it still just redirects to the detail page upon saving the record. I added the method to the old extension and I tried the formula as well. Both of them just redirect to the detail page of the VF tabbed page after saving.
If it helps, something weird happened to the URl, normally it would be (VF page name)+accountID+"overide mumbo jumbo".
Now it is all that, then "=1&tab=tabFactFinder'.
What do you think has gone wrong?
Thank you for your help with this Paul, you are a life saver!
Mikie
Could I have maybe put it in wrong?
Paste your latest controller and tabbed VF code here if you want anyone to check.
Trying to get it to redirect to the Fact Finder tab. Can anyone see what I have done wrong?
This is my extension:
This is my Fact Finder record creation page:
and this is my main VF tabbed account page:
This is my FactFinderExtension2 - Not sure if it is relevent, it is for attempting to upload an account attachment...it is not redirecting properly either..but it may be conflicting or something.
Any help or advice would be much appreciated.
Sorry, selectedtab must be the name of the tab, not the id.
So in your controller, change this line:
To this:
1. If you just put FactFinder in the selectedTab parameter of the tabPanel does it start on the FactFinder tab? If not, there's something wrong with that page and you'll need to figure out what is not working.
2. If that works, then double check that the formula I gave you is working. Just paste it somewhere on the page that's not inside of a paramter and test it. It should display AccountDetail unless you come from your FactFinder submission page.
Ok, so far so good. I changed the parameter of selectedtab to that of Factfinder and upon opening the account it was opened onto the FactFinder Tab...I am not 100% sure on step two though...paste it somewhere on the page thats not inside of a parameter and test it? Where about should I put the formula...and what should I keep the selectedtab as?
Just put the formula before the tabpanel.
This way you'll see the formula result when you open the page (this is just a temporary debugging step).
Now, when you first open the page it should say AccountDetail.
After coming from your form, it should say FactFinder.
If it doesn't then there's something wrong with the formula.
Ok, after opening the accounts page...it says accountdetail....and after creating a fact finder it now says factfinder at the top...which means and correct me if I am wrong..that the formula works perfectly....yet it raises more questions as it is not clear on why it is not working?
Does the extension have to be on both VF pages or just the record creation page?
What might the difference in URL mean?
Hey there..
Just come across the solution.. Apparently the selectedTab tag is used only for the default tab....I put your formula in front of a value tag (where the selectedtab was) and it all works and re-directs perfectly. i know the thread went stale at the end but thankyou for all your help. You are a legend.
Thank you, I'm glad you figured it out.
So what was the final tabpanel line?
like that?
Yes, exactly that and it works perfectly. Thankyou for your time and help
Despite this thread being old can you comment ont this question? I have the same tabbed page you were working with. For each related list did you have to override all of the view/edit pages to make the return to tab function work? Was it not possible to use the native view/edit screens and then redirect back to a tab? It appears that's the case.
Thanks!
Peter
I am happy to help. There are two ways you can do this, the method I have kept for about a year about going like this:
Examples:
Tab of a custom object, that is in a child (master -detail relationship with accounts):
and Class for new service page:
If i understood your question correctly, this should get you started. This is a section of my Account Tab page and the controller for the new service page, which will redirect back to the Account tab page.
Let me know if you need anything