SObjectAccessDecision Class

Contains the results of a call to the Security.stripInaccessible method and methods to retrieve those results.

System

The following are methods for SObjectAccessDecision.

  • getModifiedIndexes()

    Returns the indexes of sObjects that are modified by the stripInaccessible method.

  • getRecords()

    Returns a list of new sObjects that are identical to the source records, except that they are stripped of fields that fail the field-level security check for the current user.

  • getRemovedFields()

    Returns a map of sObject types to their corresponding inaccessible fields. The map key is a string representation of the sObject type. The map value is a set of strings, which denote the fields names that are inaccessible.

Returns the indexes of sObjects that are modified by the stripInaccessible method.

public Set<Integer> getModifiedIndexes()

Type: Set<Integer>

A set of unsigned integers that represent the row indexes of the modified sObjects.

In this example, the user doesn’t have permission to update the AnnualRevenue field of an Account.

Returns a list of new sObjects that are identical to the source records, except that they are stripped of fields that fail the field-level security check for the current user.

The stripInaccessible method performs field-level access check for the source records in the context of the current user’s operation. The getRecords() method returns the new records that contain only the fields that the current user has access to.

public List<SObject> getRecords()

Type: List<SObject>

Even if the result list contains only one sObject, the return type is still a list (of size one).

In this example, the user doesn’t have permission to update the AnnualRevenue field of an Account.

Returns a map of sObject types to their corresponding inaccessible fields. The map key is a string representation of the sObject type. The map value is a set of strings, which denote the fields names that are inaccessible.

public Map<String,Set<String>> getRemovedFields()

Type: Map<String,Set<String>>

In this example, the user doesn’t have permission to update the AnnualRevenue field of an Account.