web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Unable to cast object of type 'dynamics.ax.application..forms.VendInvoiceProdReceiptNotInvoiced' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

(0) ShareShare
ReportReport
Posted on by 152

I created a form string control  on VendInvoiceProdReceiptNotInvoiced form .

Then I used

[Extensionof(tablestr(VendInvoiceProdReceiptNotInvoiced))]

Final class test ()

{

Public display str testa()

{

Purchtable tab;

VendInvoiceProdReceiptNotInvoiced tab2;

Select tab where tab.purchid == tab2.purchid;

Return purchid.invensiteid;

}

}

However I am getting the error;

Unable to cast object of type 'dynamics.ax.application..forms.VendInvoiceProdReceiptNotInvoiced' to type 'Microsoft.Dynamics.Ax.Xpp.Common'

Then on the formstring I put data method.

I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi PrachiGupta97,

    Could you, please, share your requirement?

    VendInvoiceProdReceiptNotInvoiced is a form, so if you want to create an extension for a form you need to use formStr function instead of tableStr. But what is the purpose of testa method?

  • Blue Wang Profile Picture
    on at

    HI PrachiGupta97 ,

    Your code has many errors. When you compile it, it does not prompt?

    Please read more carefully about CoC: https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc

    About your topic , As mentioned, VendInvoiceProdReceiptNotInvoiced  is Form not Table. 

    The Common table is the base class for all tables. https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/system-tables

  • PrachiGupta97 Profile Picture
    152 on at

    When I use formstr I get an error .

    I need to display purchtable. Inventsiteid as a column on the form VendInvoiceProdReceiptNotInvoiced.

    So I created a form string control on the form and in the data method propety of the string control I put this:

    test::testa

  • PrachiGupta97 Profile Picture
    152 on at

    How do I do COC for a form?

    And I saw that in the VendInvoiceProdReceiptNotInvoiced  form  when in go to the class declaration there it extends common .

    So in my class test when I tried extending common , I got the error that no class or table with the name common exists.

  • Blue Wang Profile Picture
    on at

    Hi Sir,

    Which class extends common? I think you mean form datasource VendInvoiceProdReceiptNotInvoicedView.

    45132.PNG03644.PNG

    Please refer this blog: robscode.onl/.../

  • PrachiGupta97 Profile Picture
    152 on at

    Yes I mean that.

    So what should I change in my code?

  • Verified answer
    Blue Wang Profile Picture
    on at

    Hi Sir,

    For View, you should use:

     [ExtensionOf(viewStr(VendInvoiceProdReceiptNotInvoicedView))]
     final class VendInvoiceProdReceiptNotInvoicedView_Extension
     {
       //Your methods 
     }

  • PrachiGupta97 Profile Picture
    152 on at

    Thank you it worked.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans