We can retrieve data from MS CRM, like we retrieve data from a database. For that as in the below code, we have to first specify the attributes which we want to consider while retrieving by using ColumnSet class.
Then we can specify the conditions to be consider using the ConditionExpression class.
Also we can specify a condition operator like in SQL queries by using that class.
Then we can filter the given condition using FilterExpression class. After that we can create a query to retrieve data using QueryExpression class. By using that query we can retrieve the data as shown in below code.
ColumnSet cols = new ColumnSet();
cols.Attributes = new string[] { "name", "accountnumber" }; //name and accountnumber are two attributes.
ConditionExpression condition = new ConditionExpression();
condition.AttributeName = "accountnumber"; // Get values corresponding to accountnumber value
condition.Operator = ConditionOperator.Equal;
condition.Values = new string[] { str1[0].Trim() };
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.Conditions = new ConditionExpression[] { condition };
QueryExpression query = new QueryExpression();
query.EntityName = EntityName.account.ToString();
query.ColumnSet = cols;
query.Criteria = filter;
// Create the Web service request object.
RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
retrieve.Query = query;
// Execute the Web service request.
RetrieveMultipleResponse retrieved =
(RetrieveMultipleResponse)service.Execute(retrieve);
BusinessEntityCollection entities = retrieved.BusinessEntityCollection;
account ac = entities.BusinessEntities[0] as account;
string nameinCrm=ac.name;
Hope this will be helpful for you!!!
Business Intelligence, Data Warehousing, OLAP Implementation, Reporting and many more...
Subscribe to:
Post Comments (Atom)
tablename_WriteToDataDestination: Mashup Exception Data Source Error Couldn't refresh the entity...
Once a Dataflow is created and published on Fabric, got the below error while refreshing the Dataflow. tablename_ WriteToDataDestination: M...
-
In SQL Report Subscription, you may want to send the report with the link and you can do it by selecting Include Link value. But some time...
-
In SQL Server Analysis Services Cube, there may be a situation where we need to combine two related fact tables. This kind of a situation ma...
-
When I tried to connect to a SharePoint URL in dashboard designer options, it prompt a message saying "The URL is not available, does n...
No comments:
Post a Comment