Hi,
I am having a date field in a custom entity. I need to fetch exactly the 6 months older record by comparing that date field with the current date. How can I build the fetchxml ?
Hi,
I am having a date field in a custom entity. I need to fetch exactly the 6 months older record by comparing that date field with the current date. How can I build the fetchxml ?
Hi,
Where do you want use this logic ?
In plugin, if yes then change operator to ON instead of on or before and pass the value as
AddMonth(DateTime.now(),-6).ToShprtDateString();
no.. I need like this..
for example, if I'm having the records in my entity like this..
name, joineddate
aaa, 12/04/2022
bbb, 13/04/2022
ccc, 14/04/2022
ddd, 13/04/2022
my fetchxml will give the records having the date exactly 6 months old of joined date
the result should be if the current date is 13/10/2022 are:
bbb, 13/04/2022
ddd, 13/04/2022
result should be if the current date is 14/10/2022 are:
ccc, 14/04/2022
Hi,
You need to select below condition in your fetchXml.
On or before - set value dynamically in your c# code by using below code
AddMonths(your custom field date value, -6)
Hi,
Another way is to use the "olderthan-x-months" operator,
<condition attribute="<AttributeName>" operator="olderthan-x-months" value="6" />
Here is the doc
Hi Anandhcrm,
You can resolve your problem by using the On or Before clause.
If I answer your question then please mark it as verified.
Let me know if I can provide you with more details.
Thanks
Regards,
Abdul Wahab
Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
Direct/WhatsApp:+923323281237
E-mail: abdulwahabubit@outlook.com
Skype: abdul.wahabubit
Linkedin: www.linkedin.com/.../
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,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156