0

I have a User site guest which displays fields of an object

For example, if it's a checkbox If I do

<apex: inputField value = "{! loggedC.Expression_rens_F1__c}" />

The checkbox appears well but cannot be checked

However, with

<apex: inputCheckbox value = "{! loggedC.Expression_rens_F1__c}" />

The checkbox can be checked

My VisualForce page is as follows:

<apex:page standardController="NewR__c" extensions="VisualisationController" showHeader="false" sidebar="false" standardStylesheets="false" docType="html-5.0" cache="false">
<apex:inputCheckbox value="{!loggedC.Exactitude_rens_F1__c}" />
</apex:page>

My controller is the following:

public class VisualisationController {
  Public NewR__c loggedC{ get; set; }
    
  Public VisualisationController(ApexPages.StandardController standardController) {
       try {
            loggedC= [SELECT Id,
                                    Exactitude_rens_F1__c,
                                    FROM NewR__c
                                    LIMIT 1];
        } catch(Exception e) {
            System.debug(e.getMessage());
        }
}

I also use text fields with inputFields and they also appear uneditable

Currently my VF page is only with apex: inputField (I don't think I'll change it given the large number)

By going to Setup-> Sites-> Click on site -> Public access settings -> Object settings I see the object is read but I don't see how to put the object in modification The field is read / Modified enter image description here

I'm wondering if I shouldn't create a permission set instead of using the User site guest profile

Do you have an opinion?

4
  • A lot has changed with site guest user permissions in the last year and in general you can only do inserts, not edits. The only way around is to run controller without sharing. Here is a link to one article about the changes.
    – gorav
    Feb 9, 2021 at 13:22
  • @gorav Thanks for your response, i run controller without sharing but i still have the same problem : apex:inputField just displays without i can modify but apex:inputCheckbox et apex:inputText allow modifying
    – arnaud
    Feb 9, 2021 at 17:28
  • VisualForce Page : <apex:page controller="VisualisationController" showHeader="false" sidebar="false" standardStylesheets="false" docType="html-5.0" cache="false"> <apex:inputField value="{!loggedC.Exactitude_rens_F1__c}" /> </apex:page>
    – arnaud
    Feb 9, 2021 at 17:30
  • Apex Controller : public without sharing class VisualisationController { Public NewR__c loggedC{ get; set; } Public VisualisationController() { try { loggedC= [SELECT Id, Exactitude_rens_F1__c, FROM NewR__c LIMIT 1]; } catch(Exception e) { System.debug(e.getMessage()); } }
    – arnaud
    Feb 9, 2021 at 17:30

1 Answer 1

0

To have the permission to Edit a field with apex:inputField, we have to put the ignoreEditPermissionForRendering attribute (https://trailblazer.salesforce.com/issues_view?id=a1p3A000001YpKGQA0)

Even if this is resolved, a new error appear I can't update an object with DML "update" in User Site Guest.. I have the message "core.apexpages.exceptions.ApexPagesGenericException: system.security.NoAccessException: Access in update denied for NewR__c. Controller action methods might not not run (VisualForce page with customController)

1
  • My second mistake was that I didn't put the ignoreEditPermissionForRendering attribute on all input fields (to be put to allow the modification of a field of an object when using custom Controller for a guest user site)
    – arnaud
    Feb 12, 2021 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .