You need to sign in to do that
Don't have an account?
Using variables in the INPUTS parameter of URLFOR
Is it possible to use variables in the key of an INPUTS parameter of URLFOR?
For example, using a Custom Settings variable:
<apex:commandButton action="{!URLFOR($Action.MyObject__c.New, null, [$Setup.CustomSettingName__c.CustomFieldName__c=controllerClass.Id])}" value="My Button" title="Button Title"/>
As you can see, the action for the commandButton is the URLFOR the New functionality of MyObject__c.
I am trying to pass in an input parameter where the parameter key is a Custom Settings invocation, and the value is my controller class's Id variable.
When I try to do this, the the Custom Settings variable is not evaluated, instead the button treats it as a string literal and directs me to:
%24Setup.CustomSettingName__c.CustomFieldName__c=a0MT0000002NnCnABC
It just encoded the '$' sign and didn't evaluate the variable.
How can I use a variable as the key in the inputs parameter for the URLFOR function?
Much thanks
Did you get an answer? One way you can do this is to take the input parameter out of the URLFOR() and add it to your string.
why you use urlfor when you have option of binding any pagereference method with action. Try this