Return dotnet variable from dll wrapper

wilk_uwilk_u Member Posts: 94
edited 2016-08-19 in NAV Three Tier
I've created a dll which is a wcf wrapper, and a function in this dll which returns an custom object defined in this dll also.
Its NAV 2016, code looks like:
MyWrapper := MyWrapper.Wrapper();
ReturnedObject := MyWraper.Function(parameters);

My problem is that ReturnedObject and its properties remain uninitialised after the function call, what breaks further code flow.

Earlier int the code i call other function from wrapper which returns string - that works completely fine.

Is there a way to retrieve custom objects like this?

Returned object class has attribute
but this does not help.

Thanks for any suggestions!


  • Options
    archer89archer89 Member Posts: 337
    edited 2016-08-19
    set both .net variables property RunOnClient to Yes
    ReturnedObject must be of exact same type as the return value of fct. MyWraper.Function(parameters).
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • Options
    JuhlJuhl Member Posts: 724
    Make a variable of your object. "MyObject"

    Initialize it: MyObject := MyObject.MyObject();

    Fill the MyObject with the return.
    MyObject := Function(parameter);

    No need for sterilization.
    RunOnClient, only if, well it should.... Normally not, as all business logic runs on service tier.
    Follow me on my blog juhl.blog
  • Options
    wilk_uwilk_u Member Posts: 94
    Run on client does not help either. Turns out constructor of returned objects needs to be called directly then value can be assigned to returned object.

    Thanks a lot!
Sign In or Register to comment.