Different between this and element in Dynamics Ax


Description:-

In this article we will see a different between “this” and “element” in Ax. When we call class, table or form reference in any method or when we call method in form method then we will use this for call the class, form, method or table reference in form or table method. Here I have given different between those two keyword for differentiate.

When writing code in X++ you sometimes need to reference this. FunctionYouWant() and sometimes it is element. FunctionYouWant (). Sometimes both are in scope. I often try one and if the function I want isn’t there I try the other. Is there a rule that explains when to use “this” and when to use “element”?
“this” can be used in any objects to reference the current object and member methods.

MorphX forms and reports are composite objects.

In forms the collection of objects is contained within a FormRun object. You can reference members in the outer FormRun object by using the “element” reference.

If your code is placed at the top level there are no functional difference between “this” and “element”.
If your code is placed in a FormDataSource “this” will reference the datasource but “element” will reference the “FormRun”.

Related Posts

Previous
Next Post »

Thanks for comments.....