Skip to main content

I created a public site for my visualforce. On my page, I'm don't using Apex class, just Visualforce.

 

My page:

 

<apex:page standardController="Curso__c" recordSetVar="cursos">    <apex:pageBlock title="Plataforma de Cursos do Mario">        <apex:form >            <h1> Bem vindo, escolha um curso e bons estudos! </h1>            <br/><br/>            <apex:pageBlock title="Cursos Disponíveis:">                <apex:repeat value="{!cursos}" var="curso">                    <h1>Nome: {!curso.Name}</h1>                    <br/><br/>                    <apex:outputText value="{0,date,dd'/'MM'/'yyyy}">                        Data do curso:<apex:param value="{!curso.CreatedDate}" />                     </apex:outputText>                    <p></p>                    <apex:image value="{!curso.Link_da_Imagem_do_Curso__c}" width="350px" height="200px" />                    <p>{!curso.Descri_o_do_Curso__c}</p>                    <br/>                    <button type="button" onclick="location.href='{!curso.Link_do_Curso__c}'">ACESSAR CURSO</button>                    <hr/>                    <br/><br/>                </apex:repeat>            </apex:pageBlock>        </apex:form>    </apex:pageBlock></apex:page>

 

In Developer Console -> preview, my page works and she list my Courses (list of Curso__c) !

 

public page visualforce don't work

 

But in my public site, the list don't works... 

 

Captur.PNG

 

This is link for my public site: https://cursosmario-developer-edition.na156.force.com/

 

He dont list my Courses... Why?? Please, help me

 

#Visualforce Pages #Force.com Sites 

1 resposta
  1. 25 de jun. de 2021, 20:44

    Hi Arthur,

     

    This is most likely a data access issue. Because you've set this page on a public site, then as far as security is concerned, it's running under something called the Site Guest User. This is a heavily restricted user that, by default, has no access to anything. You need to give it access.

     

    As with any user, you need to find the guest user profile (from Site -> Public Access Settings) and ensure it has at least read access to the Curso__c object and the relevant fields.

    Then, go to Setup -> Sharing Settings, and create a new Guest User sharing rule on this object to grant it access to the individual records.

0/9000