Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 3 down vote accepted

The Force.com 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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.