Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

(0) ShareShare
ReportReport
Posted on by 25

[ExtensionOf(tableStr(InventTransOrigin))]
final class INFInventTransOrigin_T_Extension
{

public display Str yuvraj()
{

ProdBOM prodbom;


if(this.ReferenceCategory == InventTransType::Production)

{
select prodbom where prodbom.ProdId == this.ReferenceId ;
{

if(prodbom.InventRefId)
{
return prodbom.InventRefId;
}

}
}
return null;
}

}

I PUT THIS DISPLAY METHOD ON A STRING CONTROL IN INVENTTRANS FORM WITH DATA SOURCE INVENT TRANS ORIGIN 

  • GirishS Profile Picture
    GirishS 27,816 Super User 2024 Season 1 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    I don't think replacing the DB will work. You need to find the root cause of the error and fix it.

    May be the custom code other then the display method is causing the issue.

    You need to find that and solve it.

    Thanks,

    Girish S.

  • Martin Dráb Profile Picture
    Martin Dráb 230,605 Most Valuable Professional on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    Maybe not in yours, but it doesn't matter. You need to find the cause if you want to solve it.

  • ruthwik alluri Profile Picture
    ruthwik alluri 25 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    no...there is no error in my code

  • Martin Dráb Profile Picture
    Martin Dráb 230,605 Most Valuable Professional on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    Open details of the exception and look at the stack trace. This should show give more details that you've collected to far.

    The error itself is saying that you're trying to assign a form to a variable that can hold tables only, but it's important to know where it happens.

  • ruthwik alluri Profile Picture
    ruthwik alluri 25 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    yes bro even after commenting....its throwing error......i kept synchronize database....still the error was coming....so i am replacing my entire DB now

  • GirishS Profile Picture
    GirishS 27,816 Super User 2024 Season 1 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    Then I think its not because of display method. Have you done any other customizations.

    If you comment the display method is it throwing error?

    Thanks,

    Girish S.

  • ruthwik alluri Profile Picture
    ruthwik alluri 25 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    no error in display method......and also the debugger is skipping my select statement

  • GirishS Profile Picture
    GirishS 27,816 Super User 2024 Season 1 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    This is a standard piece of code where the error is throwing.

    But we are asking in display method - At which line the error is throwing in the display method you have written.

    Thanks,

    Girish S.

  • ruthwik alluri Profile Picture
    ruthwik alluri 25 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    pastedimage1683712531696v1.png

    error is showing at 92 line....what to do bro??

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,816 Super User 2024 Season 1 on at
    RE: Unable to cast object of type 'Dynamics.AX.Application.Forms.InventTrans' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

    Hi ruthwik,

    Have you confirmed that the error is coming from the display method you added?

    Because the error is saying different thing.

    Can you debug and confirm it?

    If the error is coming from the display method, debug and see exactly at what line the error is throwing.

    Thanks,

    Girish S.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Share Your Event with the Community

Jump start your event engagement! 📢

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,904 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans