function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
amoldavskyamoldavsky 

How to handle missing permissions?

Hey,

 

I have setup a test account with no writing permissions.

When I update an account nothing happends and there is no error message, how can I check if the user is allowed to update an account object?

 

Sample code:

try {
  reportToZoom(null);
  System.debug('update start');
  update acct;
  System.debug('update end');
} catch (DMLException e) {
  System.debug('exception: ' + e);
  ApexPages.addMessages(e);
}

 

The logs had this (nothing regarding permissions...):

12:29:22.163 (163884000)|USER_DEBUG|[340]|DEBUG|update start
12:29:22.163 (163892000)|SYSTEM_METHOD_EXIT|[340]|System.debug(ANY)
12:29:22.163 (163961000)|DML_BEGIN|[341]|Op:Update|Type:Account|Rows:1
12:29:22.235 (235801000)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account
12:29:22.254 (254011000)|WF_RULE_EVAL_BEGIN|Assignment
12:29:22.254 (254033000)|WF_RULE_EVAL_BEGIN|Response
12:29:22.254 (254044000)|WF_RULE_EVAL_BEGIN|Workflow
12:29:22.254 (254071000)|WF_CRITERIA_BEGIN|[Account: Microsoft Corporation 0017000000SM7cL]|BillingState|01Q70000000BG1c|ON_ALL_CHANGES
12:29:22.255 (255022000)|WF_RULE_FILTER|[Account : Billing State/Province not equal to null]
12:29:22.255 (255113000)|WF_RULE_EVAL_VALUE|Washington
12:29:22.255 (255122000)|WF_CRITERIA_END|true
12:29:22.256 (256320000)|WF_SPOOL_ACTION_BEGIN|Workflow
12:29:22.256 (256813000)|WF_ACTION| Field Update: 1;
12:29:22.256 (256829000)|WF_RULE_EVAL_BEGIN|Escalation
12:29:22.256 (256836000)|WF_RULE_EVAL_END
12:29:22.256 (256906000)|WF_ACTIONS_END| Field Update: 1;
12:29:22.256 (256915000)|CODE_UNIT_FINISHED|Workflow:Account
12:29:22.257 (257656000)|DML_END|[341]
12:29:22.257 (257724000)|SYSTEM_METHOD_ENTRY|[342]|System.debug(ANY)
12:29:22.257 (257787000)|USER_DEBUG|[342]|DEBUG|update end
12:29:22.257 (257802000)|SYSTEM_METHOD_EXIT|[342]|System.debug(ANY)
12:29:22.257 (257823000)|SYSTEM_METHOD_ENTRY|[348]|System.debug(ANY)
12:29:22.257 (257859000)|USER_DEBUG|[348]|DEBUG|returning
12:29:22.257 (257871000)|SYSTEM_METHOD_EXIT|[348]|System.debug(ANY)
12:29:22.261 (261433000)|CODE_UNIT_FINISHED|ZoomAccountExtension invoke(UpdateAccount)

 

 

Any ideas?

 

Thanks

-Assaf