if (context.InputParameters != null)
{
QueryExpression query = new QueryExpression("divine_autonum");
query.ColumnSet = new ColumnSet();
int totalrecords = 0;
EntityCollection ec = service.RetrieveMultiple(query);
totalrecords = ec.Entities.Count;
if (totalrecords == 0)
{
Entity num = new Entity("divine_autonum");
num["divine_name"] = "dota";
num["divine_pre"] = "A";
num["divine_number"] = "1";
num["divine_sepa"] = "*";
num["divine_sufix"] = "B";
tracingService.Trace("Auto numbering on account entity: Creating the trecords");
service.Create(num);
}
}
Second program
QueryExpression query1 = new QueryExpression("account");
query1.ColumnSet = new ColumnSet();
EntityCollection ec1 = service.RetrieveMultiple(query1);
int totalrecord = ec1.Entities.Count;
if (totalrecord > 0)
{
Entity num1 = new Entity("divine_autonum");
num1["divine_number"] = Convert.ToString(totalrecord + 1);
ColumnSet attributes = new ColumnSet(new string[] { "num_pre", "num_number", "num_sepa", "num_sufix" });
Guid num1Id = default(Guid);
num1 = service.Retrieve(num1.LogicalName, num1Id, attributes);
service.Update(num1);
}
}
}
}
Can i write both in same plugin i need to update "divine_number" field using plugin
how can i do it please explain
*This post is locked for comments