Activity Forums Salesforce® Discussions Does wrapper class list updated in salesforce?

  • sushant

    Member
    February 6, 2017 at 1:09 pm

    Hi Pranav,

    Yes you can update wrapper class list.Here is the example:

    public class exampleClass{

    public exampleWrapper[] wrap {get;set;}

    public exampleClass(){
    wrap.add(New exampleWrapper(New Account());
    }

    public void updateAccounts(){

    Account[] accts = New Account[]{};

    for(exampleWrapper w : wrap)
    accts.add(w.a);

    update accts;

    }
    public class exampleWrapper{
    public Account a {get;set;}

    public exampleWrapper(Account acc){

    a = acc;

    }

    }

    }

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos