now my requirement from customer..
i have bill id from third part system.
i wanted to verify bill id is exist or not in entity(kcd_creditrisk) ,field name(kcd_billingid) as simple test..
please help me .
Venkat
*This post is locked for comments
Why not just check using GetAttributeValue after you do your query expression. For example:
Guid billingId = Guid.Empty;
//queryexpression stuff here billingId = ec.GetAttributeValue<Guid>("kcd_billingid");
If you are returning multiple records in your query the you want to check each one.
Something like this would work:
foreach (Entity rec in ec.Entities)
{
if (rec.Contains("kcd_billingid"))
{
// value exists
}
}
Hi venkataramana,
if you solved the problem thanks to an answer, please mark it as verified to encourage the community to provide more and more a better support. Thank you. Francesco
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna, ITALY
Independent Contractor
Hi venkataramana,
if you solved the problem thanks to an answer, please mark it as verified to encourage the community to provide more and more a better support. Thank you. Francesco
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna, ITALY
Independent Contractor
Hi Venkat,
happy to help you again :-)
Please use the following code:
QueryByAttribute query = new QueryByAttribute("kcd_creditrisk"); query.ColumnSet = new ColumnSet("createdon"); query.Attributes.AddRange("kcd_billingid"); query.Values.AddRange(thebillingidvalue); Entity entity = svc.RetrieveMultiple(query).Entities.ToList().FirstOrDefault(); // credit risk found if (entity != null) { // do something } // credit risk NOT found else { // do something else }
Please let me know.
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna, ITALY
Independent Contractor
Yes, this value is GUID of your entity.
Hi Ficko,
in provided code
<attribute name='kcd_creditriskid' />----> is it guid id?
Venkat
You need to write a simple query that retrieves all entities that have kcd_billingid equals to your bill id value.
var fetchXml=@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='kcd_creditrisk'> <attribute name='kcd_creditriskid' /> <filter type='and'> <condition attribute='kcd_billingid' operator='eq' value='<YOUR_BILL_ID_VALUE_HERE>' /> </filter> </entity> </fetch>"; var exists = service.RetrieveMultiple(new FetchExpression(fetchXml)).Entities.Any();
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156