Query Against Filtered View?

Jan 12, 2009 at 6:39 PM
Is it possible to query against a filteredview?  I only seem to be able to query against the tables - no views.

Coordinator
Jan 12, 2009 at 9:29 PM
You can query against the entities exposed by the web service which generally mirror the filteredviews which sit on top of the tables. Querying the tables directly is normally not advised as you loose authentication and stuff. What exactly are you trying to do?

Michael
Jan 12, 2009 at 10:02 PM
I am new to CRM so there is a little bit of disconnect for me.  I realize now that I am querying off of the view - not the actual table.  Much of our existing code queries off of the filtered view (FilteredActivityPointer rather than ActivityPointer).  Using these views has been nice in that the underlying table structure is put into a single entity view.  I retrieve statuscodename with statuscode.

Are there any security concerns/issues with using LINQtoCRM against views that are NOT filtered? My limited understanding of CRM is that the filtered views used the native security model to determine what data CRM should return.  I am not sure if this occurs if I just query the base view.

Aaron
Coordinator
Jan 12, 2009 at 10:07 PM
LinqtoCRM runs on top of web service which presumably relies on the security model offered by the filtered views. Take a look at the architecture overview and give the rest of the SDK a read:
http://msdn.microsoft.com/en-us/library/bb928229.aspx

:-)
Michael


Jan 12, 2009 at 10:11 PM
Yeah... that is where I got some of my info... I put in bold the key sentence from that documentation.

Microsoft Dynamics CRM 4.0 includes SQL database filtered views that are used for business data access. Filtered views are fully compliant with the Microsoft Dynamics CRM security model. When you run a report that obtains data from filtered views, the Microsoft Dynamics CRM security role determines what data you can view in the report.

Data in filtered views is restricted at three levels: the organization, the business unit, and the owner. Filtered views exist for all Microsoft Dynamics CRM business objects (entities).

Your reports should not read data directly from the Microsoft Dynamics CRM database tables. Instead, use the filtered views. The following sample SQL code returns all columns from the filtered view for an Account entity:

On Mon, Jan 12, 2009 at 3:08 PM, friism <notifications@codeplex.com> wrote:

From: friism

LinqtoCRM runs on top of web service which presumably relies on the security model offered by the filtered views. Take a look at the architecture overview and give the rest of the SDK a read:
http://msdn.microsoft.com/en-us/library/bb928229.aspx

:-)
Michael


Read the full discussion online.

To add a post to this discussion, reply to this email (LINQtoCRM@discussions.codeplex.com)

To start a new discussion for this project, email LINQtoCRM@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jan 12, 2009 at 10:20 PM
Yes, reports run directly off the database, but that's a special case. Your standalone apps and plugins should use the web service. To make working with the web service easier, you can use LinqtoCRM. The web service respects the CRM security model as long as you make sure the right user is impoersonated (f.ex. by setting service.Credentials). (Grokking this took me some time too when I first saw it, so don't worry :-))

Here's more on the web service:
http://msdn.microsoft.com/en-us/library/cc151038.asp
And on authentication in particular:
http://msdn.microsoft.com/en-us/library/cc151049.aspx