Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Not able retrieve a particular record using c# console application

$
0
0

 Hello Guys,

 I am trying to update some records based on some condition using console application but I noticed it is not fetching a particular record .
 That particular record has status  In-Progress status.

I dont know why for loop not fetching this particular record. I am not getting any error.

var crmService = CRMHelperClass.GetCRMService();
QueryExpression qe = new QueryExpression();
qe.EntityName = "opportunity";
qe.ColumnSet = new ColumnSet();
qe.ColumnSet = new ColumnSet(new string[] { "opportunityid", "xxxx1", "xxxx2", "xxxx3", "xxxx4", "statuscode",
});
ConditionExpression condition = new ConditionExpression();
condition.AttributeName = "statecode";
condition.Operator = ConditionOperator.Equal;
condition.Values.Add(0);
qe.Criteria.AddCondition(condition);
EntityCollection ec = crmService.RetrieveMultiple(qe);

foreach (Entity r in ec.Entities)
{
Entity _opportunities = new Entity(r.LogicalName);
_opportunities.Id = r.Id;
string guid = r.Attributes["opportunityid"].ToString();
string staticguid = "27012D75-CAAC-E711-810C-5065F38B31A1";   // this is the guid of that particular record which is not fetched by this loop
if (guid == staticguid)
{
    // will do some logic
}

}

Kindly suggest


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images