Query to fetch Quick Find Columns of an entity in CRM? - dynamics-crm

I have added some Quick Find Columns in CRM. Now i would like to fetch those columns in the database. Can somebody tell me how can i do this with SQL query.

Every entity has its corresponding view and filtered view. In general only admins can access the standard views, so the recommended approach is to use the filtered views.
E.g. entity new_CustomEntity has a filtered view Filterednew_CustomEntity. From there it's common T-SQL.

Related

Odata service for two tables and how to make a master table using both tables in UI5

I want to create an OData service to fetch details from two tables of SAP and fit it using Master detail template in UI5. The first table contains only the product Id and description , while the second table contains the Product Id and product details like manufacturer address,cost , exp date etc
Currently two RFC are created writing the SELECT query on the tables to generate OData service from RFC. Shall i create One Entity set and use both RFC from Read and Query each at Map to Data Source ? or create two entity sets to map one RFC for each Entity set ?
How should be the Odata service query look to develop a master detail application in ui5 fetching data from two tables ? As well as how will make a local master table in UI5 using both table which are fetched.
Well, it depends :)
It looks like you have a 1:1 association between the product header and the details.
So you could model header and details as separate entities and define a 1:1 association between them or you could simplify you model and merge both header and detail attributes into one entity. With the information i have, i would prefer the single entity. You can use ODatas $select parameter to request only specific properties. Your DPC implementation could make use of $select and call only the header RFC if only header fields are requested.
I'm not shure if the master detail template can be used with 1:1 associations. Normally they are used with 1:n as the detail page displays a list of detail items. But you can of course leave the details unbounded in the wizard and bind additional fields later in the object header of the detail page.

update query in linq to update the data in multiple tables

I created kendo ui grid.I am able to load the data from the database.For this grid the data is coming from different tables ,I used joins in my linq query to load the data.
Now,I want to update the data using linq query,and update the data in different tables.
Any suggestions..
You have to update individual records from each table and then execute db.SubmitChanges();
In your query the output is an anonymous type, not a table type connected to the dbContext.
If you think in terms of SQL, LinqToSql works very similar.
It´s possible to select a record set with a join, but you cannot update directly on this. You need to break it up and modify entries directly one by one.
A DataContext instance tracks all the instances it loads. When you call SubmitChanges, all of the changes are send to the database in one transaction.

How to handle dynamic tables in Entity Framework

we have requirement like below :
For each customer will upload different files having different columns, column names are different from one client to another client and change in the number columns also.
For that one we will stored all the details in one table like
column1,column2,column3 ...........columnN
And will store column mapping some other table
First name=column1
Second Name=Column2
like this, up to this is ok ,but if we are using entity framework how stronly types will work in this case.
In the front end will show the combox box which will display all the client and we will show the data in the grid
Here is important thing is we have to show the End user column name instead our column name like column1,column2
Out put sholud be like below
Combox box ---- Client name
Grid
First name Second Name
---------------------------------
Harish Kumar
EF is not good choice for this type of application. It will map exactly what you have in database - one big entity with Column1, Column2, etc. properties and one entity with properties like ColumnName, PropertyName. That is all because EF doesn't support advanced data driven mapping.
Your UI / logic will need some logic to correctly interpret these data and moreover it will also have to correctly transform user input and actions back to EF understandable form.
Imho using EF for this is overhead, use ADO.NET directly. Also check SharePoint because it has this already implemented.

How to update tables from a View using Linq to Entities

I have a View in an SQL Server Database, which involves many different tables. I am using Linq to Entities to access the database, so I have no problem getting and showing view's result.
But the problem is when I want to modify some field in those results. As long as a view doesn't have a primary key, the Entity is read-only, so the question is:
Is there any way to modify the object with the view's data and save those changes in the corresponding tables?
Sorry for my english, but it's not my native language.
Thank you very much in advance!
There are some requirements for VIEW to be updatable. Take a look here. You say your view references many tables, so you have to implement INSTEAD OF trigger.

.NET 3.5 Linq Datasource and Joins

Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than one table. Does anyone know how to do this using the LINQ Datasource object?
If the tables are connected by a foreign key, you can easily reference both tables as they will be joined by linq automatically (you can see easily if you look in your dbml and there is an arrow connecting the tables) - if not, see if you can add one.
To do that, you can just use something like this:
<%# Bind("unit1.unit_name") %>
Where in the table, 'unit' has a foreign key that references another table and you pull that 'unit's property of 'unit_name'
I hope that makes sense.
(EDIT misunderstood the question, revising my answer to the following)
Your LinqDataSource could point to a view, which allows you to overcome the problem of not being able to express a Join in the actual element. From "How to: Create LINQ to SQL Classes Mapped to Tables and Views (O/R Designer)":
The O/R Designer is a simple object relational mapper because it supports only 1:1 mapping relationships. In other words, an entity class can have only a 1:1 mapping relationship with a database table or view. Complex mapping, such as mapping an entity class to multiple tables, is not supported. However, you can map an entity class to a view that joins multiple related tables.
You cannot put more than one object/datasource on a datagrid. You will have to build a single ConceptObject that combines the exposed properties of the part Entities. Try to use DB -> L2S Entities -> ConceptObject. You must be very contrived if the DB model matches the ConceptObject field-for-field.
You are best using a ObjectDataSource when you wnt to do more complex Linq and bind your Grid to the ObjectDataSource.
You do however need to watch out for Anonymous types that could give you some trouble, but anything is posible...

Resources