Which two ways allow the Architect to meet these requirements? - ProProfs Discuss
Topics
Products
Follow Us:

Which two ways allow the Architect to meet these requirements? Universal Containers has implemented a strict software architecture for their custom Apex code. One of the requirements is that all SOQL queries are contained within reusable classes. Depending on the context of the Apex transaction, the queries should be able to run either “With Sharing” or “Without Sharing”.



A. Create a SystemSOQLQueries class and a UserSOQLQueries class; set the “With Sharing” keyword on the UserSOQLQueries class and “Without Sharing” on the SystemSOQLQueries class
B. Create a reusable SOQLQueries class; do not specify “With” or “Without Sharing” on the SOQLQueries class
C. Create a reusable SOQLQueries class; do not specify “With” or “Without Sharing” on the SOQLQueries class and use the runAs () method to dynamically set the context
D. Create a reusable SOQLQueries class; specify “With Sharing” on the methods that require user context and “Without Sharing” on the methods requiring system context

This question is part of Salesforce Sharing Trivia quiz
Asked by Marcofrancesconuzzo, Last updated: Feb 23, 2020

+ Answer
Request
1

3 Answers

poojaagicha

Poojaagicha

Answered Jan 11, 2020

The correct answer is A & B.

1
 

ashishyaduka

Ashishyaduka

Answered Jun 09, 2019

The following should be the correct answers.

Create a reusable SOQLQueries class; specify “With Sharing” on the methods that require user context and “Without Sharing” on the methods requiring system context.

Create a SystemSOQLQueries class and a UserSOQLQueries class; set the “With Sharing” keyword on the UserSOQLQueries class and “Without Sharing” on the SystemSOQLQueries class.

1 1
 1

Lorenzo Barbagli

8x Salesforce Certified Salesforce Certified System Architect Salesforce solution architect: Automotive and Fashion industries

Lorenzo Barbagli

Replied on Jan 19, 2020

Wrong.. no with sharing on methods, only on classes

marcofrancesconuzzo

Marcofrancesconuzzo

Answered Jun 09, 2019

Create a reusable SOQLQueries class; do not specify “With” or “Without Sharing” on the SOQLQueries class
Create a reusable SOQLQueries class; do not specify “With” or “Without Sharing” on the SOQLQueries class and use the runAs () method to dynamically set the context
2
 1

Lorenzo Barbagli

8x Salesforce Certified Salesforce Certified System Architect Salesforce solution architect: Automotive and Fashion industries

Lorenzo Barbagli

Replied on Jan 19, 2020

Wrong.. you cannot use runAs outside test classes

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.