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
Tom DJTom DJ 

Need to detect viewable but non-editable Account record


I have run into a situation during testing (using Salesforce rolesand private sharing setting on Accounts) in which an account record becomes viewable but not editable by a user in a role.

The record turns up in the result set of a "with sharing" queryby our AppExchange application but it is not editable by the user.   This fine, but our AppExchange application needs to be able to detect that the record is not editable and warn the user.

I have tried the following code that calls the DescribeSObjectResult.isUpdateable()method on the record instance.  It return true on the record that is not editable.  It seems to be returning its result based on the user profile instead of the role assigned to the user.  Is this proper use of the isUpdateable() function?


I have tried the following two approaches also, but neither is a good solution.

  • Used AccountShare which worked fine, but we get an error on installations that says the feature is not turned on.  We cannot ask our customers to turn it on.
  • Updated the account without changing data. An exception tells the app that the account   is not editable.  But, it results in a nasty log in the log file and also the LastModified date on the record is altered when it should not be.  Not good.


Can someone help me with a solution that can determine if a viewable record is editable by a user.  It needs to be able to work across the various and sundry org types and configurations out there, and hopefully won't require too much org type detection or feature detection to work.


It would be much appreciated.  Also, I could use it ASAP because we are trying to get a release out the door.


Tom DesJardins