CRT-450 Exam QuestionsBrowse all questions from this exam

CRT-450 Exam - Question 6


A Developer wants to get access to the standard price book in the org while writing a test class that covers an OpportunityLineItem trigger.

Which method allows access to the price book?

Show Answer
Correct Answer: A

To access the standard price book in a test class, the correct method to use is Test.getStandardPricebookId(). This method is specifically designed to obtain the standard price book ID in a testing context, which is essential for covering an OpportunityLineItem trigger. The other options either involve incorrect approaches or methods not related to accessing the standard price book.

Discussion

8 comments
Sign in to comment
JankovraOption: A
Nov 10, 2022

the Right answer

mnpatelOption: A
Feb 2, 2024

It is A because Test.getStandardPriceBookid() has to be used for this purpose only.

ReynaOption: A
Apr 30, 2022

why not B ?

lmeloni91
May 27, 2022

B is not correct, it specifically states "and DELETE the existing standard price book", which is not part of the question. On the other hand, A is correct

exampletopicscomOption: B
May 15, 2022

use the @isTest(SeeAllData=true) annotation to grant test classes and individual test methods access to all data in the organization

lmeloni91
May 27, 2022

B is not correct, it specifically states "and DELETE the existing standard price book", which is not part of the question. On the other hand, A is correct

JankovraOption: A
Nov 10, 2022

It is A because Test.getStandardPriceBookid() has to be used for this purpose only. Event id it is possible to use @isTest(SeeAllData=true) to access real data from a test Class, it is possible to read the Standard Price Book or to delete it anyway.

skhan6525Option: A
Aug 16, 2023

C THE RIGHT ONE

chucksbackOption: A
Oct 29, 2023

A because the test class has a method with the same name https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_test.htm#apex_System_Test_getStandardPricebookId

DhakedDevOption: A
Jun 14, 2024

A is correct