Activity Forums Salesforce® Discussions How can I get Standard Price Book within our Test Class in Salesforce?

  • Aman

    Member
    May 31, 2018 at 7:47 am

    Hi Parv,

    For this you can make a instance of Pricebook,and then assign id of Standard Pricebook to that.

    For this,Please do the following,

    Pricebook2 standardPricebook = new Pricebook2(

    Id = Test.getStandardPricebookId(),

    IsActive = true

    );

    //Execute an update DML on the Pricebook2 record, to make IsStandard to true

    Update standardPricebook;

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos