Programatic Sharing Flashcards

1
Q

Which object do you use when you share a record using Apex?

A

Use the share object associated with the standard or custom object for which you want to share (Naming convention is the name of the object appended with __Share

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which object in a master-detail relationship do not have an associated sharing object?

A

The object on the detail side of a master-detail relationship. The detail record’s access is determined by the master’s sharing object and the relationship’s sharing setting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the 3 sharing types supported on a share object?

A

Managed sharing

User Managed Sharing

Apex Managed Sharing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which users can add or change Apex managed sharing on a record?

A

Only users with “Modify All Data”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you go about creating Apex Managed Sharing for Customer Community Plus users?

A

Share objects aren’t available to Customer Community Plus users. Consider using a trigger, which operates with the without sharing keyword by default. Otherwise, use an inner class with the same keyword to enable the DML operation to run successfully. A separate utility class can also be used to enable this access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is it possible to manually share a record to a user or a group using Apex or the SOAP API?

A

Yes, but if the owner of the record changes, the sharing is automatically deleted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When the ownership of a record change, any manual shares will be remove. How can you prevent your programmatic shares from being removed as well

A

Use Apex Sharing Reasons for the row cause (instead of the ‘manual’ one)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the runAs method enforce?
A. User permissions
B. Field-Level Permissions
C. Record Sharing

A

C. Record Sharing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When /where can you use the runAs method?

A

Only in test methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Does the runAs method use up a user license?

A

The runAs method ignores user license limits. You can create new users with runAs even if your organization has no additional user licenses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly