Skip to main content
Hi All,

Can anyone please let me know how to set person account recordtype to existed accounts. Now All the accounts doesn't have any recordtype.

Thanks & Regards,

Parasuram
1 respuesta
  1. 11 mar 2015, 15:47
    you may use the code as reference to execute anonymous in Developer Console.

    Make sure: 

    1. Get the right record type to repalce "yourexpectedrecordtype".

    2. Do a test on  small set of data first,  by modifing line

         for (Account acc : [select id from account where name ='xxxx'])

     

    id recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('yourexpectedrecordtype').getRecordTypeId();

    list<Account> accs = new list<Account>();

    for (Account acc : [select id from account])

    {

    acc.recordtypeid = recodTypeId;

    accs.add(acc);

    }

    update accs;

     
0/9000