web
You’re offline. This is a read only version of the page.
close
Skip to main content
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?

I have the same question (0)
  • 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
DAnny3211 Profile Picture

DAnny3211 126

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 117

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans