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

Announcements

No record found.

News and Announcements icon
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

  • Suggested answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at

    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.

  • pablocp_16 Profile Picture
    55 on at

    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

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans