+ Start a Discussion
mbegoun1.390645665260556E12mbegoun1.390645665260556E12 

AccountShare and replication of accounts

Hi
we have an sqlite db on user's device and would like to replicate accounts available for a user. Initial replication is not a problem - just select all accounts via API. But after initial replication lot of changes may happen when user can lose and get access to accounts.So these changes should be replicated in local DB.
I understand that AccountShare object could be used to see which accounts are shared (had been shared) by a user, but this object doesn't support getUpdated/Deleted methods.

So how can i replicate changes in account sharing for a user?

Thanks!
ShashForceShashForce
Hi,

You can "poll for changes" in the data replication result. Please see this page for more details: http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_guidelines_datareplication.htm|StartTopic=Content%2Fsforce_api_guidelines_datareplication.htm|SkinName=webhelp

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
mbegoun1.390645665260556E12mbegoun1.390645665260556E12
Thanks, but i don't see an answer here.
Polling for changes means usage of getUpdated/getDeleted methods, while AccountShare object doesn't support it.
So how can i know which accounts are available for a user anymore and which are newly shared?
ShashForceShashForce
Hi,

You can probably try to query the AccountShare object based on the created date and last modified date fields, something like greater than "the time you last did a getUpdated/getDeleted on Accounts".

Thanks,
Shashank
mbegoun1.390645665260556E12mbegoun1.390645665260556E12
There're no date fields in the object
ShashForceShashForce
Hi,

I can see LastModifiedById and LastModifiedDate fields with the exact last modified timestamp, available through Data Loader and Workbench. Hence, I'm guessing they should be available through the API as well. Can you please try?
mbegoun1.390645665260556E12mbegoun1.390645665260556E12
More details. this is what i have in AccountShare

sf:AccountId                    sf:UserOrGroupId        Row Cause
001b000000KiJcYAAV  005b0000000g04YAAQ  Owner
001b000000KiJcYAAV  00Gb00000014IhwEAE   Territory
001b000000KiJcYAAV  00Gb00000014IhwEAE   TerritoryRule
001b000000RPBphAAH  005b0000000fyeeAAA  Owner
001b000000RPBphAAH  00Gb00000014IhwEAE  Territory
001b000000RPBphAAH  00Gb00000014IhwEAE   TerritoryRule

I see 2 accounts here 3 times each, but user's id is only in the first row. What arу other IDs?
Why i have Territory and TerritoryRule records - what's differrence?
How can i see accounts which are not available anymore for a user?