Hello Everyone,
I am trying to create a queryexpression where I query a BPF entity which contains the lead entry records. The entity has the lookup field called "lead" which contains the name of the leads. As it's a lookup field, I am currently using below condition to fetch records and deleting using QueryExpression:
QueryExpression qe2 = new QueryExpression { EntityName = "new_bpf_lead", ColumnSet = new ColumnSet(true) };
qe2.Criteria.AddCondition("bpf_leadid", ConditionOperator.Equal, "********-****-****-****-************");
EntityCollection ec2 = service.RetrieveMultiple(qe2);
ec2.Entities.ToList().ForEach(y =>
{
Guid oldBPFId = y.Id;
service.Delete("new_bpf_lead", oldBPFId);
});
Now, is there any way to convert the above code to fetch actual value of that field instead of me comparing with the Guid?
I would like to change the query to something like "qe2.Criteria.AddCondition("bpf_leadid", ConditionOperator.BeginsWith, "A");" then for each loop will pick the value one by one and delete those records from the BPF entity.
I would like to achieve this using console app and not by going to advanced find and delete the records.
Please let me know for any confusion or questions.
Thank you for your help! :)
*This post is locked for comments