Knowledge found and lost while working with Microsoft Dynamics CRM
RSS icon Home icon
  • Using Filtered Views with CRM 3.0

    Posted on September 7th, 2006 mitch Print Print 4 comments

    Some of my customers use Microsoft Excel or Access to pull data from the CRM system in order to produce custom reports, or in one instance, to interface with a third-party bulk-email application.

    CRM 3.0 has a set of SQL Database Views, called Filtered Views, that are constructed in such a way that CRM Security roles are maintained and you can retrieve nothing using one of these views that you would not ordinarily see while using the CRM application.

    One aspect of using filtered views that you must take into consideration is the fact that all data ( that you have access to ) will be retrieved from the specified Entity.  This means both Inactive and Active records.

    If you don't take Inactive records into consideration your result set could be drastically different than what you expected and  you may inadvertently expend resources on inactive customers.

    Luckily, CRM provides two data fields that can be used to filter your query:

    SQL Column Value
    statuscode 1 = Active 

    2 = Inactive

    statuscodename Active 

    or

    Inactive

     

     

     

     

     

     

     

     

     

    So, here is how you would use the above:

     

    --
    -- Show only active Accounts
    --
    select * from FilteredAccount where statuscode = 1
     
    --
    -- Show only active Contacts
    --
    select * from FilteredContact where statuscode = 1
     

    This code instructs SQL Server to return all rows where the statuscode is equal to 1, which is an Active Account or Contact.

    Dynamics CRM, Reporting
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    3,590 views
     

    4 responses to “Using Filtered Views with CRM 3.0”

    1. Hi
      What is the difference in Views and Filtered View??

    2. Filtered Views are accessed directly from SQL. Views, in CRM terminology, are a view of the data from within the CRM user interface.

    3. [...] http://blogs.infinite-x.net/2006/09/07/using-filtered-views-with-crm-30/ [...]

    4. Why use statuscode instead of statecode? Is there any difference between the two (i.e. can one show "active" while the other shows "inactive")?

    Leave a reply