Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Get Records with exact date

(0) ShareShare
ReportReport
Posted on by 244

Hi,

We have an Custom Entity with Enddate field which is of date and time.

We want to get all records that have enddate exactly in next 30th day. We want to check this condition in a workflow.

Tried using the Next X days= 30 , but this will give all the records that have enddate in next 30 days, not the ones that have the enddate exactly 30 days from today.

Any OOB ways to achieve this, by using the dynamic filters in workflow?

  • Charan Raju C R Profile Picture
    7 Moderator on at
    RE: Get Records with exact date

    Hi,

    I assume you're trying to retrieve the records using fetch XML or query expression from custom workflow. In order to get the records having End Date exactly on the day 30 days from today, first you need to find out what is the exact date after 30 days from today by adding 30 days to today's date.

    DateTime desiredEndDate = DateTime.Now.ToLocalTime().AddDays(30);

    Convert this date to string with format "yyyy-MM-dd".

    string desiredEndDateStr = desiredEndDate.ToString("yyyy-MM-dd");

    Place this desired end date string to value part of the fetch XML or query expression condition.

    <condition attribute='new_enddate' operator='on' value='" + desiredEndDateStr + "' />

    OR

    QueryExpression query = new QueryExpression("new_customentity")

    {

         Criteria = { Conditions = { new ConditionExpression("new_enddate", ConditionOperator.On, desiredEndDateStr) } }

    };

  • Suggested answer
    Menna El Sayed Galal Profile Picture
    on at
    RE: Get Records with exact date

    Hello ,

    you can try using this by checking the enddate is before or after as your business logic require and use the exact days inside the condition as below

    pastedimage1611653230710v1.png

    pastedimage1611654501544v2.png

    please let me know if this help achieve what you need to achieve.

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.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 47

Overall leaderboard

Product updates

Dynamics 365 release plans