Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

pass list of class to method .net from AX

(0) ShareShare
ReportReport
Posted on by 55

Hi my name is pablo and i need some help with a problem in AX

i consume a service developed in .net and one of its methos receive a list of objects(class developed in .net)

example:

service.createtransfer(string,string,list of clas, string)

the problem is, simple list in dynamics ax not apply for this purpose.

the class i need send by this methos is

AXHISService.AXHIS.ArticuloERP articulo = new AXHISService.AXHIS.ArticuloERP();

i try this:

    System.Type listType = System.Type::GetType('System.Collections.Generic.List`1[AXHISService.AXHIS.ArticuloERP()]');
    CLRObject list = System.Activator::CreateInstance(listType);

but the listtype is null

can you help me??

please is very important.

best Regards

PABLO

*This post is locked for comments

  • pablocp_16 Profile Picture
    55 on at
    RE: pass list of class to method .net from AX

    Hi Martin, I research and the solution was very simple in my case

    my code here:

       Str msg;

       Counter   mycounter = 10;

       AXHISService.AXHIS.erpSoapClient cliente;

       AXHISService.AXHIS.ArticuloERP articulo = new AXHISService.AXHIS.ArticuloERP();

       AXHISService.AXHIS.ArticuloERP[] listarticulos = new AXHISService.AXHIS.ArticuloERP[mycounter ]();

       CLRObject   type;

       type = CLRInterop::getType('AXHISService.AXHIS.erpSoapClient');

       cliente = AifUtil::createServiceClient(type);

       articulo.set_familia("001");

       articulo.set_grupo("01");

       articulo.set_subgrupo("00001");

       articulo.set_FechaCaducidad("25/04/2014");

       articulo.set_Cantidad(23);

       listarticulos.set_Item(0,articulo);

       cliente.GenerarTransferencia("20",'23/04/2014',"01","02",listarticulos,byref msg);

       info(msg);

    thx for your time

    regards

  • Suggested answer
    Martin Dráb Profile Picture
    233,546 Most Valuable Professional on at
    RE: pass list of class to method .net from AX

    I suppose that "list of clas" means List<T>. But you're not calling this method - you're creating a method of a web service proxy class generated according the WSDL description. Whether the proxy uses List<T>, Array or something else depends on how the service reference is configured.  Therefore forget about the original method and look at parameter types of the proxy.

    If you make a reference by yourself in Visual Studio, you can change the value of "Collection type" parameter. By the way, I wouldn't use generic types - you see that working with them in X++ is difficult.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans