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
JoyceJoyce 

AccountShare & AccountTeamMember Tables (Baffling!)

I was digging into Account Teams and had two baffling questions:

  1. When does a record get inserted into AccountShare table?  In SF, when I add a new account team, I noticed that when I set the "Opportunity Access" to Private in SF, no record is inserted into AccountShare but when I set "Opportunity Access" to "ReadOnly" a record is inserted
  2. Why doesn't AccountTeamMember table retain the  LastModifiedByID?

The issue is I am trying to automate some of the account team members, including a log that keeps track of who adds team members.  AccountShare table has a LastModifiedByID I can use but a record is only inserted into AccountShare when the Opportunity Access is set to ReadOnly.  If it is not, there's no way for me to tell who added the member to the team.

benjasikbenjasik
There are many ways a record can be inserted into AccountShare, going into all of these in a post would be impossible.

One important rule is that rows do not exist in Sharing tables if they are "trivial", that is, they grant more access than default sharing. So if your default sharing was at Account read, and you tried to grant a manual share to User X with read access, the system ignores it. Only if you grant a row with Edit access would a row be inserted.

This gets complex when you throw Opportunity and Case sharing into the mix, so you'd really need to provide more details about your organizations sharing model, etc for us to be able to help.

AccountTeamMember should be retaining the LastModifiedById. Can you provide more details about how it doesn't retail the value?

This question is probably best suited for customer support as it will require details about the sharing setup specific to your organization
JoyceJoyce

Thanks for your response.

I have already opened up a case with Customer Support last week on Thursday.  They took down my case and said they will get back to me but I still haven't heard from them yet!

But, you have actually answered my question, so I'm all set.  Thanks!  I was using  Sforce Explorer to view the schema.  I thought Sforce Explorer showed the entire schema but for AccountTeamMember, it doesn't show the LastModifiedByID.    However, for other objects, it does show the LastModifiedByID so now I know not to use the SForceExplorer in my design.

I used an API call to check the schema and you are right - LastModifiedByID is there so I am all set!

Thank you!

PS.  You can delete the same post by John Saunders.  On Thursday, the login to community was broken so I had my colleague post the note for me, since he was already logged in from the previous day.

 

benjasikbenjasik
I am using the Sforce Explorer and can see it. The explorer just outputs the results for a describe, so I'm not sure why you cannot see it.
JoyceJoyce

In SForceExplorer, I dont see LastModifiedID.   I go to "Fields" in that entitie and it is not listed in AccountTeamMember. In the right pane, I click on AccountTeamMember, the Fields.  There is only 5 fields listed.

  1. AccountTeamMember
    1. Access
    2. Fields
      • AccountID
      • ID
      • SystemModstamp
      • TeamMemberrole
      • UserID

I can send you a screenshot.

JoyceJoyce

Also, the organization is a Private Model.  I am still unsure why a record is not inserted in AccountShare when the Opportunity is Private.  I will wait for the support to get back to me but isn't there some rules I can have to let me know when a record will be inserted?  It seem logically to me that a record should be iniserted ALL the time, but I guess that is not how it works.