You need to sign in to do that
Don't have an account?
JoeZaloom.ax395
Using $Action global variable in custom controller
Hello,
Is there a way to use urlfor($Action.Account.New) from a custom controller? I'm trying to redirect a user to a new Account page after performing an action on the server. I have a command button w/ an "action" attribute pointing to a custom save function in the controller named "newAccount()". After updating other Accounts I'd like to redirect the user to a new Account page, passing in certain parameters.
I can't find a way to get to the $Action global variable in the controller. Is there a way to do this? I thought about passing the $Action.Account.New to a property on the controller, but that seems hacky and kinda messy.
Is there a way to use urlfor($Action.Account.New) from a custom controller? I'm trying to redirect a user to a new Account page after performing an action on the server. I have a command button w/ an "action" attribute pointing to a custom save function in the controller named "newAccount()". After updating other Accounts I'd like to redirect the user to a new Account page, passing in certain parameters.
I can't find a way to get to the $Action global variable in the controller. Is there a way to do this? I thought about passing the $Action.Account.New to a property on the controller, but that seems hacky and kinda messy.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_sobject_describe_methods.htm
then add /e which gets you a new object page.
return new pagereference('/001/e');
the second issue is with passing values to the new page, you would have to override the new page , using a visualforce page for the new functionality, and read the passed parameters yourself once that page loaded.
The other issue I've had is passing a param w/ a commandButton. The docs state that a param will work w/ a commandButton, but I've seen other refreences in the boards saying it doesn't work. I can't seem to get it to work w/ a button, but it does work w/ a link.
Works:
Thanks for your input. Much appreciated.
js
Hi!
Exact same thing here with my apex custom controller: param is set via assignTo with commandLink but not with commandButton. It took my a painful lot of time to figure it out - thanks for this post.
I would consider this a bug - following the documentation this has to work either way - but it doesn't!
I tried this today in a spring'11 sandbox.
dr