Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.

I want to create a VisualFroce page having input fields in it. I want this page to enable Guest User to enter new record in Account Object( or any other Object).

I want headStart on how to write code for Save/Search/Edit/Delete Functions on a visulaForce page.

(Assume that i have created required input fields on visualFroce Page)

 

I can do this using Flow but i want to acheive this using VisualForce Page.

Even a link to similar solved question would do.

PS: Salesforce is new to me.
15 answers
  1. Feb 27, 2015, 2:14 PM
    Hello Friend,

    You can do it without sharing class/permission set with Account read, create, edit permission

    try this  without sharing class:

     

    public without sharing class AccountController {

    public Account account{get; set;}

    public AccountController(){

    account = new Account();

    }

    public void save(){

    upsert account;

    }

    }

     

    <apex:page controller="AccountController">

    <apex:form>

    <apex:pageBlock title="My Content" mode="edit">

    <apex:pageBlockButtons>

    <apex:commandButton action="{!save}" value="Save"/>

    </apex:pageBlockButtons>

    <apex:pageBlockSection title="My Content Section" columns="2">

    <apex:inputField value="{!account.name}"/>

    <apex:inputField value="{!account.site}"/>

    <apex:inputField value="{!account.type}"/>

    <apex:inputField value="{!account.accountNumber}"/>

    </apex:pageBlockSection>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    If this answers your question then hit Like and mark it as solution!

     
Loading
0/9000