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
jcressardjcressard 

Trouble on SalesForce Sites

Hi,

 

I have created 5 VisualForce pages and an apex class in order to have some form for quote request. These quote request add a new account and a new opportunity related, and they work fine until I stay on salesforce and access to them with a link like ***.salesforce.com/apex/mypagevf.

But I want these pages on a SalesForce Sites (which I created) and I have two problems with that:

 

1 ) All my custom fields (of account and opportunity) which I use with <apex:inputfield> don’t display on the page when I access to my domain name… Maybe I have to change the security of these fields but they already are “Changeable”.  How to access these fields on the domain name?

 

2) When I click on my button submit, the salesforce sites tell me that an authorization is required and i have to login… But I want a site where my partners can request a quote directly without connection or anything else!

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
jcressardjcressard

I've found the solution :  I had to select the record type on the personal account in order to have the quote request working...

 

But, another question : I have put "required="true"" on my fields, but even if i don't fill all the fields, the opportunity and account are created with blanks...

All Answers

sjain1.2523113033806995E12sjain1.2523113033806995E12

Hi,

      1. If you are unable to access the fields at sites then may be you dont give access permission to all fields which are essencial to that objects. Go to Public access setting of site and give access permission to field of particular object.it should be visible in sites.

      2. Basically authourization Required ERROR comes in various scenarios.

         i) If you donot give access permission to concern visual force pages directly go through Public access setting for sites.

         ii) Run the VF page internally, May be VF page throws an error related with any syntax error or governer limits inthis case it gives this error.

jcressardjcressard

Thanks for your answer.

 

1 : That's the problem, even with all checkbox checked in the permissions, custum fields don't work... If you want i can make screenshots.

 

2 : Internally, the VF pages works correctly. I think that this problem is related to the first one... In the permissions Public access, all is checked.

sfdcfoxsfdcfox

Check the "guest profile" permissions, and make sure it has permission to access the entire object; under Object Permissions, it will need to have at least read and create permissions, and possibly edit permissions if you intend to allow them to edit existing records. The authentication required message will probably sort itself out once you fix your profile permissions; permissions is a common cause for the authorization required screen.

EIE50EIE50

Hi,

 

In addendum to the above posts, make sure all your 5 VF pages and 1 Apex class are enbaled under public access settings - i mean in Guest User Profile of  your site. Site -- Public Access Settings -- Enabled Apex class access (Edit) realted list -- Enabled VF page access (Edit) related list.

 

Thanks.

jcressardjcressard

I already added the class and pages to the profile. I post you screenshots, maybe you will understand better ! (sorry, it's in french, but i think you will easily understand ! Devis = Quote, Créer = Create, Modifier = Edit)

 

Here it's the class and pages :

 

 

Here it's the permissions for the objects : (On standart objects, i can't check "Modifier" (edit)...)

 

Here it's the site internally

 

 

Here it the site on domain name with the fields disappeared...

 

 

All the fields that are not displayed or not editable are custom fields...

 

 

 

 

 

 

 

 

 

sjain1.2523113033806995E12sjain1.2523113033806995E12

have you checked all fields which are available on VF page directly go to the fields and check field level accessibilty, may be it would be hidden for site User , so you can cross check in all fields direcltly go through the fields "View field level accessibilty" button.

jcressardjcressard

Already tried too...

 

 

 

But it seems that there is no site user that i can modify permissions...

 

 

EIE50EIE50

Hi,

 

On your site detail page, click on public access settings, and scroll down to this section

 

 

Click on view link for each custom object or standard object in which your custom fields reside and make them visible to the site user. This should solve your issue.

 

Thanks.

jcressardjcressard

EIE50 => Thanks a lot for your help, this section solved the problem for the fields !! But the problem "Authorization Required" when i click on the submit button remains here...

jcressardjcressard

No solutions?

sjain1.2523113033806995E12sjain1.2523113033806995E12

Hi,

       If you are getting the Authorization Required Error there may be two reasons.

       1. Your VF Page is not enabled in sites. Go to Site-> Public Access setting -> scoll down the page-> Enable visual force access setting.

       2. If vf page getting error, then it shows this error, check internally the VF page.

jcressardjcressard

I get this error only when i click on my submit button who calls a public method in an apex code. The VF page is enabled in the site and works well when i access it into salesforce internally

sjain1.2523113033806995E12sjain1.2523113033806995E12

send me the code of submit button what's happening so that resolve the issue..

jcressardjcressard

    public PageReference submitInfo() {
    
    
    
        if ([select count() from Account where firstname = :acc.firstname AND lastname = :acc.lastname AND Ann_e_de_naissance__c = :acc.Ann_e_de_naissance__c] == 0) {
              
              Database.insert(acc);  
        
        } else {
        
          acc = [select Id, Salutation, lastname, firstname, Ann_e_de_naissance__c, Fumeur__c, Profession__c, PersonMailingStreet , PersonMailingPostalCode, PersonMailingCity, Phone, PersonMobilePhone, PersonEmail from Account where firstname = :acc.firstname AND lastname = :acc.lastname AND Ann_e_de_naissance__c = :acc.Ann_e_de_naissance__c];
        
        }
       
        
        opp.name = acc.lastname  + ' - Pret 1 - ' + date.today();
        opp.StageName = 'Demande de Devis';
        opp.Date_de_r_ception_du_dossier__c = date.today();
        opp.CloseDate = date.today()+60;
        opp.AccountId = acc.id;
        Account part = [SELECT Id FROM Account WHERE AccountNumber =: NumPart LIMIT 1];
        opp.Partenaire__c = part.Id;

        Database.insert(opp);

        return new PageReference('/DevisMerci');

    }

sjain1.2523113033806995E12sjain1.2523113033806995E12

Tryout the below sample  code instead of  new PageReference('/DevisMerci');

 

PageReference pRef = new PageReference('/DevisMerci');
pRef.setRedirect(true);
return pRef;

 

Note: Maek sure "DevisMerci " VF page is enabled or not in Public access setting.

jcressardjcressard

Thanks for your help but this doesn't work...

sjain1.2523113033806995E12sjain1.2523113033806995E12

have you checked in debug log in which line number this error you are getting.

jcressardjcressard

Where can i see this log?

sjain1.2523113033806995E12sjain1.2523113033806995E12

Go to Set up-> Administrative Permission-> Monitoring -> Debug log-> select a Site Guest User from lookup-> check which line no this error is showing.

jcressardjcressard

i've found them but i don't understand how they works...

sjain1.2523113033806995E12sjain1.2523113033806995E12

Have you select the Guest User. After select the User Run your VF Page, Refresh the debug log and check Your VF PAGE is shown in debug log.after all check the view link.

jcressardjcressard

I can't select the guest user... only the two main users !

jcressardjcressard

Up, i really need a solution...

EIE50EIE50

Hi,

 

What exactly does your submit button do? I mean, does it inserts a record in to any object? If the submit is creating a new record in SF, you may want to chech that Object's CRUD level permission for Guest User Profile.. Make sure the guest user has Create and Read level permission on the objects that you are tyring to perfomr action on.

 

Thanks.

jcressardjcressard

Yes, it create one account and one opportunity related. I have checked Create and edit fields of thoses objects on the public access settings (as you can see on my screenshots at first page), but it doesn't work... There is another place in salesforce where i can change these settings?

jcressardjcressard

I've found the solution :  I had to select the record type on the personal account in order to have the quote request working...

 

But, another question : I have put "required="true"" on my fields, but even if i don't fill all the fields, the opportunity and account are created with blanks...

This was selected as the best answer