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
miku1051miku1051 

Input field on force.com sites..Update standard object from guest user force.com sites?

I want to show opportunity fields on Force.com and also update an opportunity from force.com sites..

When i am using apex:input fields the fields are not showing in input mode.When i use inputtext it works.My problem is about date fields it comes as a inputtext and dateselector doesn't come.

Now i also want to update the opportunity record.I have found that we can't update standard object.I have found one link where it says if you use without sharing then you can update. Workarounds for Sites page to update standard object?

But i am not able to do it.Please help in this.Its really very urgent for me.

VF page

<apex:page controller="oppDetailUsersCntlr"  showHeader="false" cache="false" >
<apex:form >
<apex:sectionHeader title="Opportunity" subtitle="Detail"/>
<apex:pageBlock mode="inlineEdit" rendered="{!editSection}">
     <apex:pageBlockButtons >
         <apex:commandButton value="Save" id="saveButton" action="{!saveOpp}"/>
         <apex:commandButton value="Edit" id="editButton" action="{!editOpp}"/>
     </apex:pageBlockButtons>
     <apex:pageBlockSection columns="2">
         <apex:inputText value="{!opp.name}"/>
         <apex:inputField value="{!opp.closedate}"/>
         <apex:outputField value="{!opp.accountid}"/>
         <apex:inputText value="{!opp.Probability}"/>
      </apex:pageBlockSection> 
</apex:pageblock>
</apex:page>


Controller

public void saveOpp()
{
editSection=false;
saveSection=true;

Opportunity o=new opportunity(id=id);
o.Probability=opp.Probability;
update o;
System.debug('==============oooooooo============'+o);

}


ppoojary18@gmail.comppoojary18@gmail.com
Opportunity Object only has read and create permission for site profile. Do not use opportunity object directly on site. use custom object and write a trigger in custom object to copy the values from custom object to opportunity.