0

i have a controller.i want to execute the field values in account object.once i save the field values in vf page,the field values stored in account object.how to solve this?enter image description here

4
  • What exactly is your problem ?? Please be clear and precise. – Abbas Aug 10 '15 at 6:43
  • In save method write update acc may it will work – Shantanu Mahajan Aug 10 '15 at 6:46
  • i want to save the values in account object corresponding fields? – kiran k Aug 10 '15 at 6:48
  • hi, Shantanu Mahajan this is not working,can u modify my code? – kiran k Aug 10 '15 at 6:55
0

you need store the controller in an attribute, and in your method save call it.

EJ :

public ApexPage.StandardController controller;

public CONTRUSCTOR_NAME(ApexPage.StandardController controller){
    // ALL YOUR CODE
    this.controller = controller;


}

public void save(){
    // ALL YOUR CODE

    controller.save();
}

Another way, it can be save the account object(if you have the id you can do a update, if you haven't it you can do a insert).

EJ :

public void save(){
    // ALL YOUR CODE

    // Need catch a exception when we want insert/update the record because the insert/update can be fail for validation_rules,triggers,etc...
    try{
        insert/update/upsert this.acc;
    } catch(Exception e){
        System.debug(e);
        ApexPages.addMessages(e);
    }
}

Regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.