Hi,
My code in plugin is as given below:
IOrganizationService service = factory.CreateOrganizationService(context.UserId);
var MaxId = "0";
using (OrganizationServiceContext orgSvcContext = new OrganizationServiceContext(service))
{
var MaxId1 = (from c in orgSvcContext.CreateQuery("new_EntityName")
select new
{
Ids = c.Attributes["new_FieldName"]
}).ToList();
var maxid2 = MaxId1.OrderByDescending(x => x.Ids).First();
MaxId = maxid2.ToString();
I am trying to get max value of that field but when i run that CRM page it gives me error : "The given key was not present in dictionary".
But if i give some value to "new_FieldName" from the form that above code work properly.