Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to see who created an AccountShare record, or when they did it?

I've looked at the API docs for the AccountShare object, and it looks like there's no CreatedBy or CreatedDate information. As such, I'm guessing the answer to my question is "No," but I thought I'd ask just in case.

share|improve this question
up vote 3 down vote accepted

The IDE reveals the following, note there is a LastModifiedById and LastModifiedDate that is not documented. But yes, definitely no CreateBy or CreateDate, sorry.

enter image description here

share|improve this answer
LastModifiedBy ended up being perfect for my use. Thanks! – Benj Dec 17 '13 at 14:05
Most welcome, glad your moving again! :) – Andrew Fawcett Dec 17 '13 at 15:10

It's true, we don't see CreatedById and we can't set the field history tracking on these. To be fair it'd probably be of little value as it could be wiped out anytime admin decides to click "recalculate" on a sharing rule.

The table definition (to which you've linked) says it supports update. Well, yes and no.

Good luck with it ;)

AccountShare accshare = [select Id, AccountAccessLevel, AccountId, CaseAccessLevel, ContactAccessLevel, 
LastModifiedById, LastModifiedDate, OpportunityAccessLevel, RowCause, UserOrGroupId
from AccountShare 
where AccountAccessLevel !='All' LIMIT 1];

accshare.AccountAccessLevel = 'All';
update accshare ;

Update failed (...) First error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: RowCause (cannot update sharing row with this cause): [RowCause]

My RealForceExplorer says that not a single field has "Updateable" flag set. I haven't tried all possibilities but common sense dictates "it's not auditable "more" because there's no need to". It is whatever it is, LastModifiedById is sufficient.

If you feel like experimenting more - hopefully "User X has hit [recalculate sharing] on all Account sharing rules" will show up in Setup Audit Trail? That way you could use info from SAT and manual sharing entries to determine the full picture... But combine this with "User X has changed the team membership in Group Y and it just so happens that this group is used in sharing", "user X changed Role of user Y"... Good luck with that :/

share|improve this answer

The only information available from AccountShare is the RowCause, which will provide a hint at why the record was created. For example, if the row indicates that it was created because of a team member, you can consult the AccountTeamMember table to determine when it was shared (CreatedDate) and what role they play on the account. For manual shares, you would usually be able to identify the who and when from LastModifiedBy and LastModifiedDate, since those records are rarely modified and therefore should usually contain the same information as what you'd get from created fields.

After that, it could get very confusing to try and determine a source. For example, records might be created as a result of a sharing recalculation (the administrator did it) or because of a re-assignment (the user didn't directly share the record). Also, sharing calculations occur asynchronously in most cases, so even if the information was available, it wouldn't necessarily be accurate.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.