Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam Certified Platform Developer II topic 1 question 270 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 270
Topic #: 1
[All Certified Platform Developer II Questions]

A company wants to run different logic based on an Opportunity’s record type.

Which code segment handles this request and follows best practices?

  • A.
  • B.
  • C.
  • D.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
dasabhisek404
1 day, 22 hours ago
Selected Answer: C
Option D is given wrong. It was- Id recType_New = Schema.SObjectType.Opportunity.getRecordTypeInfosByDeveloperName().get('New').getRecordType.Id(); Id recType_Renewal = Schema.SObjectType.Opportunity.getRecordTypeInfosByDeveloperName().get('Renewal').getRecordType.Id(); In that case C is right
upvoted 1 times
...
parth9927
1 month, 2 weeks ago
Selected Answer: C
C is also the correct answer because it can handle code dynamically. don't need to hard code record type name.
upvoted 1 times
...
stan_malta
7 months, 4 weeks ago
Selected Answer: D
Save SOQL where you can.
upvoted 1 times
...
Udayudyvk1818
11 months, 1 week ago
Selected Answer: D
answer should be D. to simply use getRecordTypeInfosByDeveloperName https://salesforce.stackexchange.com/questions/11968/what-would-be-the-best-approach-to-get-the-recordtype-id
upvoted 3 times
...
Ullr
1 year, 3 months ago
D only Don't SOQL to RecordType
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in