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

  • How do I Create Person Account in Test Class in Salesforce?

     Aniya updated 1 week, 2 days ago 3 Members · 4 Posts
  • Anuj

    Member
    July 7, 2020 at 11:58 am

    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 .

Viewing 1 - 4 of 4 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos