Saturday, May 05, 2007

Change default (first) page in APEX

Having seen this question often (yesterday again in the OTN APEX forum) and having had the same problem when I first started with APEX, I thought to blog about it.

When you make your first application in APEX you typically have as default page 1 or the login page (101). If you want to change your default (first) page you need to have a look at three different places. Let's say we want to have page 9 as default page:

1) Application Builder > Your Application > Page 101 > Processes (Page Processing) > Login
Change Process to:

P_FLOW_PAGE => :APP_ID||':9'
Whenever somebody logs in we want him to go to page 9.

2) Shared Components > Security > Authentication Schemes > Your Authentication
Change the Logout URL: wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID.&p_next_flow_page_sess=&APP_ID.:9

If somebody logged out, we set the default page to 9 as that's our default page.

3) Shared Components > Security > Edit Security Attributes
Change the Home Link to: f?p=&APP_ID.:9:&SESSION.

If no page is specified this is the page to go to for ex. f?p=100 means we're going to application 100 with as default page, the page specified in the Home Link. You can also reference this url by #HOME_LINK#.


Anonymous said...

Thank you Dimitri for your answer.
But i think that in the future should be much easier to change such properties. Just a parameter at the application level!
Best regards

Anonymous said...

Thanks, you're the man.

Anonymous said...

You've saved me from a major headache, a simple thanks won't suffice but that's all i can say.

Thanks again.

Suddenly I realised said...

I was VERY happy to find this - I agree this should either be made MUCH simpler to do by ApEx, or, even better, be a user choice when creating an application.

I have one question, though: I did all three changes, and it works fine. What does NOT work is, if I export the app, and import it with a different ID as run-only (for deployment.) In that case, the logout process STILL uses :app_id:1 (and not :10 like I changed it to.)

Any ideas?

(Thanks still for a clear explanation!)

Castorani said...

Thanks a lot for this post, it was really helpfull

Anonymous said...

thanks, most helpfull

anjali said...


Making the changes as you said will take me to a specific page. But if i want to send user to different pages how can I do that.

e.g if user is dummy he should go to page 3 and if user is abc he should go to page 1.

How can I achieve this?
please respond as soon as possible.

Thanks in advance.

Frank Schmidt said...

Thanks for this complete and compact Tip!
Kind Regards, Frank

Anonymous said...

Thank you.

Apex -X said...

Worked perfect. thanks

Jack said...

Hi Dimitri,

I am facing issue on setting up default page even I have checked my all 3 settings which you have described in this post.
My default page should be 7 but sometimes users are redirecting to page 1.

Please suggest.


Anonymous said...

my apex homepage is not working after i run forms builder and forms application. could you please give solution for this.
Thanks in advance.

Anonymous said...

Thanks for this. I'm having a problem though that if someone tries to log in and fail page security, if they press ok and log in with a user who passes page security Apex tries to take them to page 1 (ignoring my settings of page 2). Do you know how to stop this. Thanks

Anonymous said...

Actually as soon as I posted my comment I realised the page direction was been set by the login page (call to wwv_flow_custom_auth_std.login, p_flow_page)

Nick Adams said...

I agree with your with.Thanks you share with me this nice post.Keep it up...

Anonymous said...

My requirement has slight change where different users type should be directed to different pages. So

I wrote like this :

l_routeto number;
l_errordesc varchar2(4000);
lc_clob CLOB;


IF upper(trim(:P101_USERNAME)) = 'ABC' THEN
l_routeto := 1;
elsif upper(trim(:P101_USERNAME)) = 'DEF' THEN
l_routeto := 201;
elsif upper(trim(:P101_USERNAME)) = 'HIJ' THEN
l_routeto := 301;
l_routeto := 1;

P_FLOW_PAGE => :APP_ID||':'||l_routeto

when others then


I was able to land into respective pages allocated to Username 'ABC ' and ' DEF ' but got an error when i try to login with username 'HIJ'.

Please help me out.

Thanks & Regards,
Vikram S

Dimitri Gielis said...

What error did you get? Maybe the page didn't exist or has an authorization on?