Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

D365 | Specified cast is not valid.

(0) ShareShare
ReportReport
Posted on by 68

I have programmed a filter to filter the non-rental vehicles, I get the error message "Specified cast is not valid." do you have a solution?

Greetings
Eaven

 pastedimage1660641132502v2.png

  • EavenCS Profile Picture
    EavenCS 68 on at
    RE: D365 | Specified cast is not valid.

    [DataSource]
    class ERSRentalTable
    {
    /// <summary>
    //
    /// </summary>
    public void executeQuery()
    {
    utcdatetime rentFrom = element.ValidFromFilter.dateTimeValue();
    utcdatetime rentTo = element.ValidToFilter.dateTimeValue();

    if (rentTo == DateTimeUtil::minValue())
    {
    rentTo = DateTimeUtil::maxValue();
    }
    else if (rentTo < rentFrom)
    {
    rentTo = rentFrom;
    }

    QueryBuildDataSource qbdsRental = this.query().addDataSource(tableNum(ERSRentalTable));

    qbdsRental.joinMode(JoinMode::NoExistsJoin);

    this.query().validTimeStateDateRange(rentFrom, rentTo);

    super();
    }

    }

    [Control("DateTime")]
    class ValidFromFilter
    {

    public boolean modified()
    {
    boolean ret;

    ret = super();


    ERSCarPoolTable_ds.executeQuery();
    return ret;
    }

    }

    [Control("DateTime")]
    class ValidToFilter
    {
    /// <summary>
    //
    /// </summary>
    /// <returns></returns>


    public boolean modified()
    {
    boolean ret;

    ret = super();
    ERSCarPoolTable_ds.executeQuery();

    return ret;
    }

    }

  • Komi Siabi Profile Picture
    Komi Siabi 12,770 Most Valuable Professional on at
    RE: D365 | Specified cast is not valid.

    Hi EavenCS,

    Your filter is obviously not well defined. You mind sharing your code ? (Please use the rich formatting ->Insert code)

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans