I'm having an issue with a PageReference redirect that is unexpected for me and out of the ordinary compared to what I'm used to.
I have a custom detail button which directs the user to a custom VF page and controller where logic is completing some checks/updates and then redirecting the user to the standard managed package VF page.
However at that point the name of the managed package vf page is duplicating which is causing me to get the following error:
The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores.
My code is contained below - I've been able to do this with other managed packages before like FinancialForce but for some reason Steelbrick is being trickier:
String redirectUrl = Page.sbaa__Approve.getURL();
system.debug('@@@urlstring' + redirectUrl);
if (approve == 'true'){
pageReference redirect = new pageReference('/'+redirectUrl+'/?scontrolCaching=1&id='+approvalId);
//redirect.setRedirect(true);
return redirect;
}
Error message displayed and here is the url:
/apex/sbaa__approve/approve/?scontrolCaching=1&id=aD8C0000000CacjKAC