web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Usage of element keyword in Dynamics 365/ X++

(1) ShareShare
ReportReport
Posted on by 31
"As a beginner in Dynamics F&O, I’d like to understand the purpose of using the 'element' keyword instead of 'this' or 'formrun.' In what scenarios is it best to use 'element' over 'this'?"
I have the same question (0)
  • Jonas "Jones" Melgaard Profile Picture
    4,894 Most Valuable Professional on at
    Usage of element keyword in Dynamics 365/ X++
    Element and FormRun is coupled with forms. I haven't found a F&O specific page, but this AX2012 version briefly touches on it: Using Variables with Forms | Microsoft Learn
    You should use element when you are working with forms. A good tip is to try to find an example pattern in the standard application and stick to it.
     
    For the rest, there is this X++ syntax - Finance & Operations | Dynamics 365 | Microsoft Learn article on Microsoft Learn.
  • Verified answer
    Navneeth Nagrajan Profile Picture
    2,361 Super User 2025 Season 2 on at
    Usage of element keyword in Dynamics 365/ X++
    Hi Dinesh,
     
    1. element: references the FormRun so if we place our code outside the datasource on the entire form, both element and this references to the FormRun() object.
    2. this: If your X++ code is placed inside a form datasource then it will reference the datasource whereas element in this case will still reference to the FormRun(). 
     
     
    References:
     
    Hope this helps.
     

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
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans