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 :
Finance | Project Operations, Human Resources, ...
Answered

tosTring method override

(0) ShareShare
ReportReport
Posted on by 75

Hello!

There is a class with few fields: List(types::record), PurchId, Amount, Status. I want to override tostring() method so that it returns current state of the class object, for example:

while(listEnumerator.movenext())
{
    recIdStr  = listEnumerator.current().RecId;
}

return strfmt("%1; %2; %3; %4", PurchId, Amount, Status, recIdStr);


I'm gonna use this method in my unit test cases:

this.assertEquals("expected state", myClass.toString());

Tell me please, what are the troubles that may be committed by this solution?

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    I don't see any troubles, but did you face some? Or why are you asking?

    On the other hand, I don't understand why you want to override the toString() method for this - can't you just add your own method?

  • Yakhin Rifat Profile Picture
    75 on at

    I didnt face troubles. I saw similar code in C# projects. But i will probably make own method.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans