Activity Forums Salesforce® Discussions How do I Create Person Account in Test Class in Salesforce?

  • Kirandeep

    Member
    July 7, 2020 at 11:59 am

    String recordTypeId = Schema.getGlobalDescribe().get('Account').getDescribe().getRecordTypeInfosByName().get('Person Account').getRecordTypeId();
    Account acc= new Account(
    RecordTypeID=recordTypeId ,
    FirstName='Test FName',
    LastName='Test LName',
    PersonMailingStreet='[email protected]',
    PersonMailingPostalCode='12345',
    PersonMailingCity='SFO',
    PersonEmail='[email protected]',
    PersonHomePhone='1234567',
    PersonMobilePhone='12345678'
    );

    insert acc;

  • Aniya

    Member
    October 11, 2021 at 7:07 pm

    hi my name is aniya i need a test for my brother and my sister

  • Aniya

    Member
    October 11, 2021 at 7:08 pm

    hi i need a test for my friends and i am a techer so i need a test i text the pepole and tell they i need a test .

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos