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 :
Supply chain | Supply Chain Management, Commerce
Unanswered

X++ Saving optional record in form with data source change group set to None

(0) ShareShare
ReportReport
Posted on by
Dear all,
 
I have an issue saving an optional record in a form. The form displays a list of records from a /Books/ table. Each /Book/ record may have one or more translations. On the form, users have the possibility to enter the default translation (set to the system language, i.e., en-US).
 
Data model:
 
//
 
/Book/ is the main data source on the form; /BookTranslation/ is the optional data source. It is joined with an outer join to the /Book/ data source. The init() method has been overridden on the /BookTranslation/ data source, to ensure only 1 record is selected.
 
//
 
//
 
//
 
When I try to save a record, the /Book/ field on the /BookTranslation/ data source is left blank, causing the save operation to fail.
 
//

The form has /Data Source Change Group/ set to /None/, which apparently causes this behavior. Changing this property to /ImplicitInnerOuter/ would solve the issue, but, unfortunately, this is not a viable solution, as the actual scenario is an extension of a standard form (this is a simplified example).
 
I have tried to override the write() method on the data sources, but this did not help. As per documentation, I was expecting that each data source got saved in its own transaction, following the method call sequence below:
  1. Book.validateWrite()
  2. Book.write()
  3. BookTranslation.validateWrite()
  4. BookTranslation.write()
Adding code to the Book.write() method would allow me to set up the needed values in the /BookTranslation/ record. However, the methods are actually called in the following order:
  1. Book.validateWrite()
  2. BookTranslation.validateWrite()
  3. Book.write()
  4. BookTranslation.write()
This would require to perform this initialization in the validateWrite() method, which seems the wrong place to me. Additionally, since validateWrite() is called before write(), i.e., before the record is saved to the database, I do not have the possibility to read the Book's /RecId/ (in the actual scenario, /BookTranslation/ is linked to /Book/ via RecId, not via ISBN).
 
Does anybody have suggestions on how to solve this issue? I would be grateful for your feedback.
 
Best regards,
Daniel
I have the same question (0)

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 > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 305 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 67 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans