Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / How to handle or retri...
Finance forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

How to handle or retrieve data contract with list ?

Posted on by
Hello expert,
 
I have data contract of Header and Detail, lets say Header class name is MyHeader and Detail class is MyDetail, which is as normal the detail is declared in Header data contract as a list just at the bottom of the Header data contract, something like this :
 
[DataMember(/myDetails/),
    DataCollection(Types::Class, classStr(myDetail)),
    AifCollectionTypeAttribute('_myDetails', Types::Class,classStr(myDetail)),
    AifCollectionTypeAttribute('return', Types::Class,classStr(myDetail))]
    public List parmMyDetails(List _myDetails = myDetails)
    {
        if (!prmIsDefault(_myDetails))
        {
            myDetails = _myDetails;
        }
        return  myDetails;
    }
 
 
And how the code run later in my API is something like : 
myHeader  response = new myHeader();
 
and there is new variable List      myList to cater all the information to pass to Detail data contract.
There is actually nothing's wrong to pass on the details, which usually by create a list variable as well and pass it to the response like this :
response.parmMyDetails(myList)
 
Up to here is fine. But currently I have intention to retrieve again what's passed to that response.parmMyDetails and put in a string variable.
 
May I know how to do this ?
 
I think we cannot just call again this /response.parmMyDetails/, and put it in the list, like below :
 
ListIterator    listIterator = new ListIterator(response.parmMyDetails());
 
 
how can I achieve my intention, to retrieve again the list ? This retrieval, btw, is still inside the same function, so my API process actually already run well up to pass to API response, but now I'm gonna need to have addition of getting those details back into a string, for other purpose (logging)
 
Sorry, understand this can be confusing.
 
Let me know if I need to rephrase all this. Thanks.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,207 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans