Hi
I am trying to remove the ‘SalesType’ range from the SalesOrderHeaderV2Entity as I want to use the dual-write to create orders as journals.
When I pass in the SalesType as journal it is transformed to ‘Sales order’ in the SalesOrderHeaderV2Entity on creating the record because of the range which is set to ‘Sales order’.
Tried using this code but the datasource object is always null
[DataEventHandler(dataentityviewstr(SalesOrderHeaderV2Entity), DataEventType::InitializingEntityDataSource)]
public static void SalesOrderHeaderV2Entity_onInitializingEntityDataSource(Common _sender, DataEventArgs _eventArgs)
{
QueryBuildDataSource qbd;
SalesOrderHeaderV2Entity salesHeaderEntity = _sender as SalesOrderHeaderV2Entity;
FormDatasource fb = salesHeaderEntity.dataSource();
qbd = fb.query().dataSourceTable(tableNum(SalesTable));
qbd.clearRanges();
}
We duplicated the entity and removed the range and are able to create sales journal but since I want this for dual-write I have to use the standard entity.