Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

when i write below in anonymous block,its executes successfully


In my Debug log i can see

03:56:52.045 (45470054)|USER_DEBUG|[3]|DEBUG|Name

I assume its standard Account class which is displaying field names? Does this have any practical application>

share|improve this question
add comment

2 Answers 2

Indeed there are many practical use cases.

Here is one for your reference:

share|improve this answer
add comment

From the system.debug documentation:

If the msg argument is not a string, the debug method calls String.valueOf to convert it into a string. The String.valueOf method calls the toString method on the argument, if available, or any overridden toString method if the argument is a user-defined type. Otherwise, if no toString method is available, it returns a string representation of the argument.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.