Activity Forums Salesforce® Discussions How can you update Salesforce record using Apex?

  • Piyush

    Member
    August 23, 2019 at 3:29 am

    Hi Prachi,

    Using Dynamic Apex we can achieve this :

    //Lets assume this is record Id
    Id recId = ‘a0P9000000ESXcV’;
    Schema.SObjectType token = recId.getSObjectType();
    Sobject s = token.newSobject();
    s.put(‘Id’,recId );
    s.put(‘Name’, ‘om’);
    update s;

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos