+ Start a Discussion
GoForceGoGoForceGo 

Redirect to a page

 

I have a controller extension and a VF page X that binds to it. This Page X displays all the information about the Object. On Page X, I have a custom button 'Approve/Reject' which takes me another VF page Y that binds to same controller extension (i.e there is no redirect).

 

Now I am writing a separate "Items To Approve" page Z that has a Approve/Reject link. I would like the take the user directly to Page Y.  I am running into following issues:

 

1.  When I directly go to Page Y, I get the error "...SOQL without querying the requested field". Essentially it is complaining that fields that are referenced on Page X have not been loaded - that's how controller extensions work.

2. I tried action = "{!redirectToApprovalPage}" on Page X. Essentially on load, if "gotoapproval=true", I want to redirect to the approval page.  However, it doesn't redirect - I get to Page X - less any salesforce styling.

3. In #2, if I say page.setReDirect(true), I loose all the state

 

Any thoughts?

 

 

GoForceGoGoForceGo

In Page Y, I did an <apex:include pageName = "Y" rendered = "false"/>. This gets around the issue listed in #1 above.

 

It seems to work, but doesn't sound like an elegant way to do it!

 

 

kiranmutturukiranmutturu

for the first issue if you included the field as hidden field on each page where ever you are trying to access.. 

GoForceGoGoForceGo

Right. The problem is that page X has lots of fields. I don't want to add each of them. Also when I modify page X, I would have to modify every other page.

 

Easiest thing, as I mentioned is to do a an <apex:include> of page X with rendered = false