I have a visualforce page that I'm using to redirect a user to a second and final visualforce page in an attempt to bypass a CSRF Token request (it's from a managed package). I can't seem to get the parameters to pass correctly to the final visualforce page. From the debug it appears that the controller is assigning the variables correctly, but it doesn't look like the pagereference method isn't pushing the parameters to the redirect visualforce page.
I have a suspicion that the URLFOR() address is not formatted correctly, which is where the parameters are getting stuck.
Redirect Visualforce page:
<apex:page controller="Screen_Flow_Redirect" showHeader="true">
<apex:slds />
<script src="/soap/ajax/55.0/connection.js" />
<script type="text/javascript">
function init() {
redirectURL = "{!URLFOR(IF($Site.prefix == '/s','/apex/dfsle__gendocumentgenerator',$Site.Prefix +'/apex/dfsle__gendocumentgenerator'), null,[sId='sId',templateId=''+'templateId'+'',recordId='recordId',title='title'])}";
if (sforce && sforce.one) {
sforce.one.navigateToURL(redirectURL);
} else {
document.location.assign(redirectURL);
}
}
init();
</script>
</apex:page>
Controller:
global without sharing class Screen_Flow_Redirect {
public String title = 'Send with Docusign';
public String recordId = ApexPages.currentPage().getParameters().get('recordId');
public String sId = ApexPages.currentPage().getParameters().get('sId');
public Id templateId = ApexPages.currentPage().getParameters().get('templateId');
public String sendWithRedirect(Id templateId, String sId, String recordId, String title) {
PageReference pr = Page.VF_Redirect;
pr.getParameters().put('sId',sId);
pr.getParameters().put('templateId',templateId);
pr.getParameters().put('recordId', recordId);
pr.getParameters().put('title', title);
return pr.getUrl();
}
}
Error message: I am attempting to replicate the feature of a detail page button, this is what launches the page I need and what the URLFOR() function in my VF page should redirect to.