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, ...
Unanswered

Unable to cast object of type 'Dynamics.AX.Application.FormStringControl' to type 'Dynamics.AX.Application.FormReferenceControl'

(0) ShareShare
ReportReport
Posted on by 75

Hello!

I hope you can enlighten me on this.

I am trying to call all 'case categories' and 'category types'. Basically what you see here:

8863.pastedimage1651757983893v1.png2308.pastedimage1651758156043v2.png

I'm trying to get something similar to the 'Case category' field to appear. But when trying it I get the following error:

Unable to cast object of type 'Dynamics.AX.Application.FormStringControl' to type 'Dynamics.AX.Application.FormReferenceControl'.

I understand that the error occurs when trying to convert the 'String' to the data type that belongs to 'Case category'. But I have created my field with the same properties as the original, and in the 'Category types' I have no problem calling it. I want to know if anyone knows how I could solve this.

Here's an example of the form I'm designing:
[View:/cfs-file/__key/communityserver-discussions-components-files/765/2500.AX-365-on-DESKTOP_2D00_D03BVN5-_2D00_-Virtual-Machine-Connection-2022_2D00_05_2D00_05-09_2D00_49_2D00_52.mp4:320:240]

 

I have the same question (1)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    A good course of action would be finding where the error is thrown. You can, for example, add a breakpoint to Info.add(), debug your code amd look at the stack trace.

  • MarcosAP25 Profile Picture
    75 on at

    But, where can i find the 'Info.add()'??

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi MarcosAP25,

    As per Martin's suggestion, You can place a breakpoint in add method in Info class.

    From the video you have shared, it looks like the error is getting triggered when you try to perform lookup. Do you have any code in the lookup method?

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Info is a class, therefore either expand Code > Classes node in AOT and find it there, or use a filter in Application Explorer (e.g. ^Info$ type:class). Open the class in designer, put add in the Search box and the select the add method in the filter list. Double-click it to open it in code editor and that's where you can add a breakpoint.

  • MarcosAP25 Profile Picture
    75 on at

    No, I don't add any method.

    I was investigating, and it seems that the field that I want to use is a reference group, and from what I could see, it is made with a relationship to the parent table, which I relate to the 'RecId'. I will try to follow this logic and tell you how it turns out.

  • MarcosAP25 Profile Picture
    75 on at

    I have achieved my goal, and indeed, the error was due to the data type.

    What I have done is to create in my table a field of type 'Int64' that will store the 'RecId' of the record of my parent table. I have created the corresponding relationship and in my form I have added both data sources, I set the 'Join Source' property of my data source to 'CaseCategoryHearchyDetails' which is my parent table. After that I created a Reference Group.

    Here is the process I followed:

    AX / D365FO – Cómo usar el grupo de referencia en un formulario en AX 2012 – Blog de AX / Dynamics 365 For Finance and Operations (d365ffo.com)

    Here the result:

    [View:/cfs-file/__key/communityserver-discussions-components-files/765/AX-365-on-DESKTOP_2D00_D03BVN5-_2D00_-Virtual-Machine-Connection-2022_2D00_05_2D00_05-12_2D00_09_2D00_24.mp4:320:240]

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans