You have a few options here.
- An actionFunction:
actionFunctions are created with the visualforce tag and will create a JavaScript method that you can invoke from anywhere else on your page (an onclick, your own script, etc.)
Within the actionFunction, you can put an tag which will link a var you pass to the actionFunction to a property on your controller. Check this sample controller/page that demonstrates the general setup:
<apex:actionFunction action="{!controllerMethod}" name="javascriptFunctionName" reRender="stuff">
<apex:param name="publicToken" value=""/>
<apex:param name="accountId" value=""/>
</apex:actionFunction>
Now, in your JavaScript, you can do the following:
javascriptFunctionName(public_token, metadata.account_id);
Invoking that JS function will invoke the action in your actionFunction and assign the values you pass as args to the params. So then in your controller, you can do this:
public void controllerMethod() {
String publicToken = ApexPages.currentPage().getParameters().get('publicToken');
String accountId = ApexPages.currentPage().getParameters().get('accountId');
//Do whatever you need to do here with the publicToken and accountId.
}
- A RemoteAction: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
RemoteActions expose methods in your apex controller extension to your scripts. In your controller, you would have a method that would look something like this:
@RemoteAction
public static void controllerMethod(String publicToken, String accountId) {
//Do what you need to with publicToken and accountId...
}
The way you would use this in your JavaScript then is like this:
ControllerName.controllerMethod(public_token, metadata.account_id, function(result, event) {
//This is a callback which will have the result if your controller method returns any value.
});
You can ALSO write the same method invocation like this:
Visualforce.remoting.Manager.invokeAction("ControllerName.controllerMethod", public_token, metadata.account_id, function(result, event) {
//This is a callback which will have the result if your controller method returns any value.
});
It is a common assumption that the HTML to PDF engine presently used by Salesforce is Flying Saucer that only supports version 2.1 of CSS (W3C Recommendation 07 June 2011) whereas SLDS is designed to work with modern browsers only that support version 3 CSS.
So while you may be able to eventually get some parts of the SLDS markup to work, the PDF output is unlikely ever to be as you would like it to be. Including simple CSS used just for the PDF output is the simplest workaround.
Best Answer
You can instead use global variables for your requirements
so if your parameter name is lang
you can use
Once you access from URL i think the global variable will be automatically decoded.