Hi guys ,
I have written a batch job to get value of entity attribute while looping through entity .
I m using on line crm 2015.
foreach (Entity r in ec.Entities)
{
if (r.Attributes.Contains("xxx1") && r.Attributes.Contains("xxx2"))
{
if (Convert.ToDateTime(r.Attributes["xxx3"]) <= DateTime.Now)
{
r.Attributes["xxx1"] = null;
try
{
crmService.Update(r);
msg = "entity updated successfully";
CRMHelperClass.writeToTextFile(msg);
}
catch (Exception)
{
msg = "Error while updating" + Environment.NewLine;
CRMHelperClass.writeToTextFile(msg);
string k1 =r["xxx1"].ToString(); //giving error
string k2 = r.Attributes["xxx3"].ToString(); // giving error
msg = k1 + "," + k2 ;
CRMHelperClass.writeToTextFile(msg);
msg = "**************************************************************************************************************************************************";
CRMHelperClass.writeToTextFile(msg);
}
}
}
}
*This post is locked for comments