Notifications
Announcements
No record found.
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 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.
ThanksRegards,
Abdul WahabPower Platform & Customer Engagement Developer/Lead/Solution Architecture/Project ManagerDirect/WhatsApp:+923323281237E-mail: abdulwahabubit@outlook.comSkype: abdul.wahabubitLinkedin: www.linkedin.com/.../
Another way is to use the "olderthan-x-months" operator,
<condition attribute="<AttributeName>" operator="olderthan-x-months" value="6" />
Here is the doc
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)
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:
result should be if the current date is 14/10/2022 are:
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();
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 170 Super User 2025 Season 2
#ManoVerse 61
Gerardo RenterÃa Ga... 52 Most Valuable Professional