1

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

enter image description here Has anyone else ran into and solved this error before?

1
  • Can you edit your question to include a complete url which gives you this message? Jun 7, 2017 at 20:29

1 Answer 1

1

Remove the first dash after redirectUrl. Your browser think it's looking for a page named ?scontrolCaching, instead of a page named approve‌​ with some url parameters. Your full url should look like this:

https://advisory--q2cdev3--sbaa.cs12.visual.force.com/apex/s‌​baa__approve/approve‌​?scontrolCaching=1&i‌​d=aD8C0000000CacjKAC
1
  • Now I just feel stupid - can't believe I overlooked that. Thank you so much for your help!
    – cg13
    Jun 7, 2017 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .