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
loscar73loscar73 

Cannot edit or save visualforce page

Hi,

 

I have created a public visualforce page that allows non-licensed users to enter data related to our accounts. This visulforce page is feeding a custom object titled Productivity. The users can visit the site but there are two issues that occur when trying to enter and save data:

 

1. Only the Project Number field is available for data entry -- all others fileds are closed

2. When clicking Save, the user gets a an Authorization Required error

 

I have pasted the code below. I have enabled debug logs but cannot find any exception errors.

 

Any guidance and recommendations are greatly appreciated!

 

Thanks,

Carlos

<apex:page standardController="Productivity__c">
<center>
<h1>Welcome to the Boart Productivity Suite</h1>
<br/><br/>
</center>
<apex:form id="ProductivityForm">
    <apex:pageBlock >
        <apex:pageMessages />
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!Productivity__c}" var="p">
        <apex:column headerValue="Enter Your Details">
            <table>
                <tr>
                    <td>Project Number:</td><td><apex:inputField value="{!p.Project_Number__c}"/></td>
                    <td>Customer:</td><td><apex:inputField value="{!p.Cust_Name__c}"/></td>
                    <td>Date:</td><td><apex:inputField value="{!p.Date__c}"/></td>
                </tr>
                <tr>
                    <td>Region:</td><td><apex:inputField value="{!p.DS_Region__c}"/></td>
                    <td>Zone:</td><td><apex:inputField value="{!p.DS_Zone__c}"/></td>
                    <td>Branch:</td><td><apex:inputField value="{!p.DS_Branch__c}"/></td>                    
                </tr>
                <tr>
                    <td>Rig:</td><td><apex:inputField value="{!p.Rig__c}"/></td>                
                    <td>Shift Number:</td><td><apex:inputField value="{!p.Shift_Number__c}"/></td>
                    <td>UOM:</td><td><apex:inputField value="{!p.UOM__c}"/></td>
                    
                </tr>
                <tr>
                    <td>Drill Amt:</td><td><apex:inputField value="{!p.Drill_Amt__c}"/></td>                    
                    <td>Drill Hours:</td><td><apex:inputField value="{!p.Drill_Hrs__c}"/></td>                    
                    <td>Other Billable Hours:</td><td><apex:inputField value="{!p.Oth_Billable_Hrs__c}"/></td>
                </tr>
                <tr>
                    <td>Billable Reason:</td><td><apex:inputField value="{!p.Billable_Reason__c}"/></td>
                    <td>Other Non-Billable Hours:</td><td><apex:inputField value="{!p.Oth_Nonbillable_Hrs__c}"/></td>                
                    <td>Non Billable Reason:</td><td><apex:inputField value="{!p.Non_Billable_Reason__c}"/></td>
                </tr>
            </table>
        </apex:column>
        </apex:pageBlockTable>        
    </apex:pageBlock>

</apex:form>
</apex:page>

 

 

loscar73loscar73

So I found that although the user is getting the Authorization Required error when saving the VF page, records are actually being created to the object in the PROD environment. Is there some security setting I am missing? Do I need a custom controller to make my object public?

g.engelg.engel

Are there any __r fields in the Productivity object?  It may be that the user doesn't have permission to access the related record, but the page can still save the data.

 

Perhaps posting all the fields in the schema for the Productivity__c object would give more clues.

 

loscar73loscar73

There is a lookup against the Account object with the field named Cust_Name__c. I have given the Guest User Productivity Profile read and create access to Accounts but the problem still persists when clicking save. I have pasted all the fields used on the Productivity object below. Any ideas?

 

Account  Cust_Name__c  Lookup(Account)

Billable Reason  Billable_Reason__c  Picklist

Date Date__c  Date

Drill Amt Drill_Amt__c   Number                             

Drill Hrs  Drill_Hrs__c Number(2, 2)                        

DS Branch DS_Branch__c Picklist

DS Region  DS_Region__c Picklist

DS Zone DS_Zone__c Picklist     

Non Billable Reason Non_Billable_Reason__c    Picklist

Note Note__c   Text Area(255)

Oth Billable Hrs Oth_Billable_Hrs__c Number(2, 2)

Oth Nonbillable Hrs Oth_Nonbillable_Hrs__c  Number(2, 2)

Project Number  Project_Number__c    Text(10)

Rig Num Rig__c Text(8)

Shift Number Shift_Number__c Picklist

UOM UOM__c  Picklist

SantoshiSantoshi

Can you please verify the deployment status of your object? Please make sure that your object is in the deployed status. You can go on your object detail page and verify the deployment status. If the status is 'In development'  then this can be one reason for the error other can be field level security.

loscar73loscar73

The object has been deployed. The fields are there but when I click SAVE I get the authorization error. The URL is pointing to the newly created record because I can see the record ID at the end of it. I can verify that records are being created, it is just when the user clicks SAVE they get the unauthorized error. Any way to redirect them back to the page after SAVE so that they can continue to enter information?

SantoshiSantoshi

I think i understood the reason. You are getting un authorised error because when you click the save button ideally it redirects to the salesforce standard detail page. But,here its not possible because that mechanism works when you log in in salesforce thats the reason it throws error . What you need to do is ,design one more vf page as detail page.. Put all the field as output field in the page and give non-licensed user access to this page.On the click of save redirect to this page. This is a workarond but i think its fine to do this..