Display your account name using a custom controller and input filed at visaulforce page

Display your account name using a custom controller and input filed at visaulforce page



Extension Controller: use to build custom functionalities that are not available at Standard controller. We can create more than one extension controller at a visualforce page.


Visualforce Page:

<apex:page controller="customAccController">

    <apex:form>

        <apex:pageBlock title="Hi {!$User.FirstName},">

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

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

        </apex:pageBlock>

    </apex:form>

</apex:page>

Custom Controller:

public class customAccController {

    private final Account account;

    public CustomController() {

        account = [SELECT Id, Name, Site FROM Account
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

    public PageReference save() {
        update account;
        return null;
    }

}

If you have any confusion regarding this Blog, feel free to comment, I will definitely resolve your issue. 😃 Also! Please comment if you want me to post any new tutorials that you like to learn 😄😄



Trigger Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ https://sujay-salesforce.blogspot.com/2019/08/trigger-most-common-interview-questions.html


Visualforce Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***

Apex Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***


Lightning Component Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***



Lightning Design System Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***


Freelancing Services At Salesforce: Freelancing Services


For Job Support click this URL: Job Support




Comments

Popular posts from this blog

Trigger Update Contact record using trigger when account record is updated

If you looking for Salesforce Certified Freelancer for you Salesforce org works feel free to contact us, details are in below:

Context variables in triggers