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 :
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

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,965 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

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans