URL Redirect to open VisualForce page from Skuid

  • 1
  • Question
  • Updated 3 years ago
  • Answered
We have a visualforce page that is used to create records based on a custom object.  (Eventually we want to rewrite this in skuid, but until then...)

In standard salesforce, the New button is overridden by the visualforce page.

I'm trying to create a link from a Skuid account detail page to create a new record for this object.
-------------------------
The link as it appears when called from standard Salesforce (parameter variables in bold):

/apex/techDataReq?CF00Nj000000981G8=TEST+ACCOUNT&CF00Nj000000981G8_lkid=001j000000WFP8W&scontrolCaching=1&retURL=%2F001j000000WFP8W&sfdc.override=1

-------------------------
Here's the URL I've built using merge fields in Skuid:

/apex/techDataReq?CF00Nj000000981G8={{#urlEncode}}{{Account_Name__c}}{{/urlEncode}}&CF00Nj000000981G8_lkid={{Account__c}}&scontrolCaching=1&retURL=%2F{{Account__c}}&sfdc.override=1



-------------------------
However, when I click the link from the Skuid page, none of the merge fields show up in the URL:

/apex/techDataReq?CF00Nj000000981G8=&CF00Nj000000981G8_lkid=&scontrolCaching=1&retURL=%2F&sfdc.override=1


Any help is much appreciated.
Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Not sure if that will fix it,

But basic checks you can make:

-Make sure the {{Account_Name__c}} & {Account__c}} fields are added to your model
-Make sure you have permissions to view those fields in Salesforce
-I've never to had to do this before for a url, but worse case maybe you need to point to the model + field. If so u can try this syntax:  {{$Model.YOURMODELNAME.data.0.Account__c}} 

Hope it helps

Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb
Thanks for the pointers, Dave.

Fields included in model - check.
Permssions to view fields - check.

I tried the syntax you suggested, but got the same results -- Still no merge field values.

I did get a small improvement using {{$Param.id}} instead of {{Account__c}}.  I tried hard coding the account name along with the Param.id just as a test and it still failed:



When side by side testing (visualforce called from standard vs skuid), the error above persisted until I changed the domain prefix from:
mydomain--skuid
to
mydomain--c

So while I'm still not getting {{Account__name__c}} to show up in the URL, I have a very different challenge ahead as well.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Jared,

I have had to put in the 'full' URL to redirect to a VisualForce page.  Something like this:

https://mydomain-c.cs26.visual.force.com/apex/nameOfpage

You may want to start with the URL above and then add parameters one by one while troubleshooting along the way.

The other thing you will want to try is a triple mustache for the parameters.  Instead of {{Account__c}} change it to {{{Account__c}}}.  This ensures that you get 'just' the value and not a hyperlink.  With a double mustache on a lookup field, Skuid will try to render the hyperlink instead of passing in the 'id' that you want.

Thanks,

Bill
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
To get a relative link from a skuid page to a standard vf page you can use syntax like this:   /apex/c__visualforcePage   This means that the page will be sourced from the visualforce namespace (and the initial part of the URL will be correct) and the skuid namespace will be ignored.    Again the key is "c__" before the vf page name.  
Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb
Thanks, Bill and Rob.

The redirect is working now:

/apex/c__techDataReq?CF00Nj000000981G8={{#urlEncode}}{{Account_Name__c}}{{/urlEncode}}&CF00Nj000000981G8_lkid={{$Param.id}}&scontrolCaching=1&retURL=%2F{{$Param.id}}&sfdc.override=1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,364 Points 10k badge 2x thumb
Rob,

Thanks for the tip on pre-pending the vf page name with 'c__'.  I learned something new!

Best,

Bill