"Creating" the URL using {{$Site.CurrentSiteUrl}} and a UI formula field

  • 2
  • Question
  • Updated 3 weeks ago
  • Answered
We need to create a url in our managed app (so the mydomain will vary each time) and I thought one slution would be with a UI formula field and using merge syntax

eg 

{{$Site.CurrentSiteUrl}}&"/apex/etc"

Sounds good.. but it is blank.

Has anyone got any clues for us?

Any help would be appreciated
Photo of David Forder

David Forder

  • 2,198 Points 2k badge 2x thumb

Posted 1 month ago

  • 2
Photo of Matt Davis

Matt Davis, Employee

  • 734 Points 500 badge 2x thumb
Is there any reason against keeping the links generic? In Skuid, I usually just have links that look like this in a template 

<a href="/apex/skuid__ui?page=PNT.Oppty.Detail&oppid={{{Id}}}" target="_blank">{{{Name}}}</a>

or in an action to go to link

/apex/skuid__ui?page=PNT.Oppty.Detail&oppid={{{Id}}}

It is odd that those global merges aren't working though, since I am seeing the same thing in my testing org...
Photo of David Forder

David Forder

  • 2,198 Points 2k badge 2x thumb
Thanks Matt .. Two reasons .. we have a managed app and with the removing of instance names by sf I was trying to arrive at a solution. Also, we need to display a few std salesforce pages (without header and sidebar) and the relative url method in an iframe has stopped working for us. If I use a full url it does the job but obviously for us the full url only works on our dev org.
Photo of Matt Davis

Matt Davis, Employee

  • 734 Points 500 badge 2x thumb
I gotcha, yeah that makes sense. It seems like I'm hitting the same issue with the merge syntax so I'll see what product people think is going on.
Photo of Emma

Emma

  • 254 Points 250 badge 2x thumb
I'm having the same issue too with being unable to get the merge syntax to surface. Any updates?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,026 Points 20k badge 2x thumb
So the merge function {{$Site.CurrentSiteUrl}} only works in the context of Force.com sites (and maybe communities).  See the doc here.  My understanding is that we are depending on the underlying VF global variables,  which are not present for standard pages. 

Supporting this requirement may require the population of that field with some code.  Dang... 
Photo of David Forder

David Forder

  • 2,198 Points 2k badge 2x thumb
Dang ) ..

We were able to create a sf formula field on user 

LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))

This provided us with the sf domain which we need but when I use this in an iframe on a template skuid overwrites it with the skuid url and sf then blocks the iframe.

Anyway to override skuid switching the url from vanilla salesforce just this time?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,026 Points 20k badge 2x thumb
I think your missing the namespace in your URL within the iFrame.   Skuid is forcing its namespace back onto the page.  You can either use the global namespace (c__) ,  or your own manage package namespace. 

Admittedly this is a shot in the dark on a Sunday night.  But I think there is merit there.