Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / return records that go...
Finance forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

return records that got created in certain dates

Posted on by 254
Hi,

I'm trying to look for records in a certain period inside my sysOperationFramework class. But the while loop is not being entered:

while select table1
            where table1.InventLocationId == 'XX'
                && DateTimeUtil::date(table1.CreatedDateTime) >= _contract.parmFromDate()
                && DateTimeUtil::date(table1.CreatedDateTime) <= _contract.parmToDate()      
        {
            info("hello");
        }
what did i do wrong?

However, when i did this code in a runnable class. it returned the correct records:
 
 while select table1
            where table1.InventLocationId == 'XX'
{
        FromDate fromDate = DateTimeUtil::date(table1.CreatedDateTime);
        if(fromDate >= 25\6\2024 && fromDate <= 26\6\2024)
        {
            Info("hello");
        }
}


what i want is:

1. When fromDate and ToDate in the contract parameter are empty, then my while select should return everything
2. When ToDate is filled alone and From is Empty, then the while should return all records that have createdDateTime <= ToDate
3. When Both are filled, then it should return records in this period

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,451 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,353 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans