• #54150

    How Can I Insert, Update the Account Records from Vf page using Remote actions..??

    How Can I Insert, Update the Account Records(using  custom controller class) from Vf page using Remote actions..??


    Thanks in advance


    Salesforce | Jade Jade #10

    Hi Mallesh,

    Definitely you can Update and Insert Account or any object Record using JavaScript Remoting.

    check the below code:

    //This is a javaScript Remoting function, you can use it to update/Insert Account
    <script type="text/javascript">
    function getRemoteAccount() {
        var account = {!accRec}; //Initialize an account in your controller like, Account accRec{get;set;}
        //Then set the values of this from your page
            function(result, event){
                if (event.status) {
                    //Even account get updated, you will get the values in "result"
                } else if (event.type === 'exception') {
                    document.getElementById("responseErrors").innerHTML = event.message;
                } else {
                    document.getElementById("responseErrors").innerHTML = event.message;
            {escape: true}
    In apex you can have this method.
    Public Static void updateAccount(Account acc){
        if(acc != null){
               update acc;
           }catch(DMLException de){
               System.debug('DML Exception');
    Hope this will be helpful!!!
Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?