function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
oleg.tuchschereroleg.tuchscherer 

URLFOR(..) in conjunction with CUSTOM DOMAIN and managed package

Hi,
i have installed a managed package in a Sandbox and in the Live Org.
"My Domain" is configured.
An Email Template contains a formula, computing a link: {!SUBSTITUTE(URLFOR('/apex/VFPage'),'http:','https:')}
Linkg points to a Visualforce Page.
Visualforce Page is a part of managed package.

SANDBOX: url created by the formula in the sandbox is correct
------------------------------------------------------------------------------------------------
https://factory42--sb42--sf42-prfxpe.cs17.visual.force.com/apex/VFPage

LIVE: url is wrong
------------------------------------------------------------------------------------------------
https://factory42--c.eu3.visual.force.com/apex/VFPage
As you can see the the namespace prefix (sf42-prfxpe) is missed. Instead of prefix a '--c.' appears in the url. 

The correct url looks as the following:
https://factory42--sf42-prfxpe.eu3.visual.force.com/apex/VFPage

Any ideas to get formula working in the live org?
Thanks in advance!
William TranWilliam Tran
if you use this: https://factory42--c.eu3.visual.force.com/apex/VFPage  - do you get an error or does it work?  

or does it redirect you to https://factory42--sf42-prfxpe.eu3.visual.force.com/apex/VFPage?

thx
oleg.tuchschereroleg.tuchscherer
https://factory42--c.eu3.visual.force.com/apex/VFPage does not work.
The message "page VFPage does not exist" appears.
William TranWilliam Tran
Hmm, Oleg, I assume you created a VFPage right?

In your other code, does URLFOR work for your organization or all?

Try a simple VFpage below call it URLFORTEST and see if it redirect to you the account page or does not redirect you to "factory42--c" and error out.

thx.
 
<apex:page action="{!URLFOR('/001')}">
</apex:page>

then change URLFORTEST to to see if it direct you to the VFPage :
<apex:page action="{!URLFOR('/apex/VFPage')}">
</apex:page>


 
oleg.tuchschereroleg.tuchscherer
No, i have an email template. When a special record is created an email based on email template is sent to user. Email template contains a link. This link should open a visual force page, which is a part of a managed package.
URLFOR works fine in VF pages.
How to get it working in email template?
William TranWilliam Tran
Then you should hard code the URL in the email template:

https://factory42--sf42-prfxpe.eu3.visual.force.com/apex/......

You can put this string in a variable if you want, but dont use relation path.

Thx