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
LaurentDelcLaurentDelc 

Problem accessing attribute in VF page in Sites after packaging

Hi everyone,

 

We have a weird problem: After packaging, and whatever type of package we use to do so, the VF page in Sites doesn't retrieve values that has been fetched in the controller.

It ONLY happens in Sites. We have used the same page from the private url and it works. In the packaging org it works on both side.

So it's definitely a Site issue  after packaging.

We tried with a unmanaged package to try and debug. But everything seems to happen ok: the controller is called, the SOQL request gets the values, no exception is sent. But in the VF page there is nothing in place of what should be displayed.

 

Here is a simple example:

 

 

 

public class cont { public String color {get;set;} public cont(){ color = [select color__c from Color__c limit 1].color__c; } } VF page:<apex:page controller="cont">Color:{!color} </apex:page>

 

 

 

 

 No exception is thrown but the color is not displayed if we use this in Site after packaging the application and install it to a DE org.

 

Probably linked to this problem we can't access the page aymore. We need to prefix it with the package prefix manually. By example:

http://oooooooooooooo-developer-edition.na6.force.com/default?foconfig=carreer

doesn't work but

http://oooooooooooooo-developer-edition.na6.force.com/EosTrial98__default?foconfig=carreer 

 works. 

 

We also noticed that the prefixed pages look a bit weird:

 

<apex:page controller="EosTrial98.FrontOfficeConfigExt" showHeader="false"><apex:composition template="EosTrial98__CareerSiteTemplate"> 

Isn't it supposed to be a . and not __ ?

 

Our direct conclusion is that everything is linked in a way. Also it seems that we started to ave these problems since middle of last week. 

 

 

Any idea?

 

Laurent 

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

Here is the latest on this. We closed the bug, because this is working how it;s supposed to be and here is why:

When you reference a page within a package you need to qualify the name space. there could be several other pages with the same name coming from different packages or you might have create one directly. If you don't specify the page with the name space then system wouldn't know which page is getting referenced. 

 

here are  the correct ways to refer to page "mypage" within package namespace "ns".

In VF page: $Page.ns__mypage
In Apex code: Page.ns__mypage

 

you need to use this regardless of site use case. When you are logged in to salesforce system changes the domain name and keeps the page name clean. 

 

But in site context since we do not want to change the branded domain name page name will include the name spece as well like following:

 

In URL: http://mydomainname.force.com/ns__mypage

 

 

  


All Answers

ryan_marplesryan_marples
When you come across a value showing on a Visualforce page when logged into salesforce.com but not showing when viewing via Sites, there's a pretty good chance that it has to do with the security settings. Either the object or field is most likely hidden for the profile associated with the site. Can you check that and let us know?
BulentBulent

Here is the latest on this. We closed the bug, because this is working how it;s supposed to be and here is why:

When you reference a page within a package you need to qualify the name space. there could be several other pages with the same name coming from different packages or you might have create one directly. If you don't specify the page with the name space then system wouldn't know which page is getting referenced. 

 

here are  the correct ways to refer to page "mypage" within package namespace "ns".

In VF page: $Page.ns__mypage
In Apex code: Page.ns__mypage

 

you need to use this regardless of site use case. When you are logged in to salesforce system changes the domain name and keeps the page name clean. 

 

But in site context since we do not want to change the branded domain name page name will include the name spece as well like following:

 

In URL: http://mydomainname.force.com/ns__mypage

 

 

  


This was selected as the best answer
LaurentDelcLaurentDelc
Hi,
 
First thank you for the quick answers.
 
I am now aware of this prefix thing. I will try to show the prefixed URL everywhere.
 
But this is a different problem. Now that we can access the page  main problem arrives. Even with the prefix the values are not populated with the values we got from the database. We know the SOQL worked as we saw the results in the debug log. But still, the values are not displayed on the page. 
Again this works perfectly in every package when we use the back office url but not with the Site url. It also works everywhere when it is not in an installed package.
 
Our conclusion is that it is linked to Site and Package installation.
 
Have you looked into this prefix curiosity I told you? The fact that it is a "." and not a "_" on the prefix of the Controller of the visualforce page? 
LaurentDelcLaurentDelc

And we checked all the security settings and profile. 

 

And as I said previously this exact same page works in a normal org with Site but not in a org we installed the package to so I think it is definitely something between package install and Site.

 

Thanks,

 

Laurent 

BulentBulent

Can you provide the url for the site this is working fine?

So I can compare pubic access settings of both sites 

Message Edited by Bulent on 08-20-2009 10:28 AM
LaurentDelcLaurentDelc

The org we packaged from:

http://powdugpofvopevewj-developer-edition.na6.force.com/apex/default?foconfig=Test

-> works fine

 

The org we packaged to->

http://assdasdasdasdzcx-developer-edition.na6.force.com/apex/default?foconfig=carreer

-> doesnt display the data in the VF page. (but get them from SOQL request)

 

 

One important precision.

This last one is an org we installed an UNMANAGED package. This way we can assure the SOQL worked good. This is why I can assume the public profiles and security settings are alright.

 

It also means this is related to neither the type of the package nor the prefix thing as an unmanage package doesn't put any prefix. Am I right?

 

Cheers,

 

Laurent 

 

BulentBulent

Laurent,

 

custom object in this org are not in "deployed" status. In order to site to display data from these objects they need to be deployed. 

LaurentDelcLaurentDelc

Thank you very much it owrks.

 

I have never heard of that before but indeed this was the problem.

 

Thank you again.

 

Laurent 

BulentBulent
It works for your authenticated user because that user is a system administrator user. Try with non-sysadmin user you will see the same result like you see on sites.