Hi CU20060538-1,
Read the hands on exercise lab that you are referring to. Would prefer doing this through data entities.
SysExtensionSerializer is a helper class that is used to find tables that are based on a table buffer and an extension table buffer that comes from the the joined data source. SysExtensionSerializerExtensionMap is used to map all extension tables.
Suggestion:
If you are using the hands on lab to create a new sales order then would recommend the following:
1. In your init() method you need to call SalesTable instead so the FormDataSource_ds code will be.
FormDataSource salesTable_ds = formRun.dataSource(formDataSourceStr(SalesTable,SalesTable));
If you use SalesTableCreateNew it is going to retrieve an empty record.
2. Similarly, in your write() method you need to amend this change.
FormDataSource Mb500SalesTable_DS = this.formRun().dataSource(formDataSourceStr(SalesTable,SalesTable));
Also, in your SalesTable you can add a code like this if you are looking to use the SysExtensionSerializerMap
public MB500SalesTable mb500SalesTable()
{
return this.SysExtensionSerializerMap::getExtensionTable(tablenum(MB500Table);
}
And write an extension on insert() method like this.
public final class SalesTable_Extension
{
void insert()
{
next insert();
MB500SalesTable mb500SalesTable = SalesTable.mb500SalesTable()
mb500SalesTable.SysExtensionSerializerExtensionMap::insertAfterBaseTable(SalesTable);
}
}
Understand you are doing a hands on lab but if you are doing this example in realtime, then your code needs to go into the OnClicked Event hander on the Sales Order new button.
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(SalesTableListPage, NewSalesOrder), FormControlEventType::Clicked)]
public static void NewSalesOrder_OnClicked(FormControl sender, FormControlEventArgs e)
{
//Code snippet and custom field actions will go in here.
}
In addition to this, there will be additional code that you can add based on your requirement.
Hope this helps. Happy to answer questions, if any.