I am looking at building my own e-signature plugin for CPQ since I just can't get the Docusign provided one to work correctly. The plugin requires me to return a redirectURL for the e-signature application and I want to just redirect to the
dsfs__DocuSign_CreateEnvelope page with a lot of parameters. This is similar to making a custom button, but I'm hoping to do it in code to skip a step.
When I try returning the redirectURL, I get an error:
The link you followed isn’t valid. This page requires a CSRF confirmation token. Is there a way to get the CSRF token added as a parameter in Apex? Here's my code so far.
PageReference pr = Page.dsfs__DocuSign_CreateEnvelope;
The Docusign built integration sends the user first to a page that doesn't require CSRF and an OK button the user has to click and it builds the URL using URLFOR in the Visualforce page. I can replicate that, but was hoping to skip the intermediate page.
The reason I'm even trying to roll my own is that the Docusign built integration doesn't give me enough control over the parameters sent to the CreateEnvelope page. I want to use merge fields from the related object and Docusign's envelope configuration only lets me put in static values.