locked
[CRM4] How to find all records shared to a team? RRS feed

  • Question

  • Is there anyway to form a query expression to retrieve a list of all records shared to a specific team / user

    ie:
    - Retrieve all contacts shared to team "East Coast"
    - Retrieve all accounts shared to "Bob Hunter"


    I don't want to have to retrieve every record first then check to see if that record is shared.
    • Edited by es_ Wednesday, June 17, 2009 4:43 PM
    Wednesday, June 17, 2009 4:42 PM

Answers

  • Hi,
    You could try with this query
    This query finds out all the lead shared with the team named 'Test Team'

    select  fl.subject
    from 
    FilteredLead fl,  PrincipalObjectAccess poa,  FilteredTeam ft
    where
    poa.ObjectTypeCode = 4 
    and poa.ObjectId =fl.leadid
    and poa.PrincipalId = ft.teamid 
    and ft.name='Test Team'
    
    Regards,
    Nishant Rana
    http://nishantrana.wordpress.com
    Thursday, June 18, 2009 9:28 AM

All replies

  • Hi,

    You are not able to search by the security model "out of the box"... you must do coding .... plugin....not a good solution at all....

    Morten
    Wednesday, June 17, 2009 5:36 PM
  • After searching through the SDK files, it appears there is no way to retrieve all accounts shared to a particular user or team using code.  If you have access to the SQL server, you can execute a query against the crm database to achieve the same goal.

    select * from principalobjectaccess where principalid = 'guid of the user or team'

    Now, you have to be a local admin on the sql box or be in the privuser group, i think.  There's no filteredview that has this information and because you are querying the table directly instead of querying a view, this is technically unsupported.

    If you are willing to allow the code to run overnight, you can loop through all contacts or all accounts and retrieve the users and teams to whom the records have been shared using the SDK, but if you have a large number of records, that could take a while.

    Wednesday, June 17, 2009 10:29 PM
  • Hi,
    You could try with this query
    This query finds out all the lead shared with the team named 'Test Team'

    select  fl.subject
    from 
    FilteredLead fl,  PrincipalObjectAccess poa,  FilteredTeam ft
    where
    poa.ObjectTypeCode = 4 
    and poa.ObjectId =fl.leadid
    and poa.PrincipalId = ft.teamid 
    and ft.name='Test Team'
    
    Regards,
    Nishant Rana
    http://nishantrana.wordpress.com
    Thursday, June 18, 2009 9:28 AM