In X++ we often come across an issue that we are unable to access an object member (e.g. a form method) via this keyword. Instead we CAN access the same form method via element keyword. So what’s the difference between them?
The difference is of the scope. To understand how it works, let’s assume that we are standing at a button’s click method on a form and we need to access a method defined at the form level (e.g. readResourceFile() in this case). In this situation this keyword cannot access the method since its scope is only limited to the members of the current object. For example with this keyword we can access all the members of the button object. However, we can access the form-level method using the element keyword.
So element keyword has a bigger scope as compared to this keyword.

*This post is locked for comments