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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

SysODataCollectionAttribute - Pass in List of objects

(0) ShareShare
ReportReport
Posted on by 81

The below code is throwing a compile error:

"Abnormal termination with unhandled exception. Exception key: a76d7897-189b-4bde-be62-7d5383a61c4f. System.NotSupportedException: The type <Class> is not support."

[SysODataActionAttribute("UpdateEndUserLinesV2", false),
        SysODataCollectionAttribute("_lines", Types::Class, classStr(WSTG_EndUserLine))]
public static str updateEndUserLinesV2(str _lotId, List _lines)
{
   // do something
        return "Test";
}

How do I tell the compiler I am expecting a list of "WSTG_EndUserLine" ?

I have the same question (0)
  • Suggested answer
    huijij Profile Picture
    19,813 on at

    Hi PhillyNJ,

    The SysODataCollectionAttribute class enables OData to expose strongly typed collections from X++. This class takes in three parameters:

    The name of the parameter that is a list (Use return for the return value of the method.)

    The X++ type of the members of this list

    The public name of the OData resource that is contained in the collection

    learn.microsoft.com/.../odata

  • Martin Dráb Profile Picture
    239,857 Most Valuable Professional on at

    Hi Judy, you've marked your reply as a suggested answer, but it's not clear how your snippet of the documentation answers PhillyNJ's question. Please explain it.

  • GirishS Profile Picture
    27,843 Moderator on at

    Hi PhillyNJ,

    I don't think you can make use of type class for SysODataCollectionAttribute.

    So please go through the below link which may be useful for you.

    https://nuxulu.com/2021-05-25-all-about-odata-actions-in-dynamics-365-finance-and-operations/

    Thanks,

    Girish S.

  • Verified answer
    Martin Dráb Profile Picture
    239,857 Most Valuable Professional on at

    The error seems to say that SysODataCollectionAttribute doesn't support classes. I've seen it used only with primitive data types or with data entities.

  • Martin Dráb Profile Picture
    239,857 Most Valuable Professional on at

    GirishS, you're saying that the solution for using a collection of WSTG_EndUserLine objects is declaring the type as Types::Record instead of Types::Class, but is it true? I don't think that it'll allow PhillyNJ to use WSTG_EndUserLine class. You can use public names of data entities (not class names) with Types::Record.

  • huijij Profile Picture
    19,813 on at

    Hi PhillyNJ,

    According to your error message, it's clear that the wrong parameter was passed, the link I shared has instructions on how to use the method, the second parameter should not be of type class.

    43371.Capture.PNG

  • PhillyNJ Profile Picture
    81 on at

    goshoom - I think you are correct. I will need to find a better solution... Thanks for the help

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 463 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 423 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 392

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans