Order Type | BC Enum | GP Enum |
Quote | 0 | 1 |
Order | 1 | 2 |
Invoice | 2 | 3 |
Credit Memo | 3 | 4 |
Hope this might be helpful:
The most effective way to align your Dynamics GP "Sales Document Type" values with Business Central's Enum values for display on your List Page is to perform a data transformation during the Query.Read
loop, before inserting into your temporary table.
This ensures your temporary table stores consistent BC Enum values, allowing for proper display and filtering.
Here's how to do it within your OnOpenPage
trigger:
OnOpenPage()
var
BCQuery: Query "Your BC Sales Query"; // Your first query for BC data
GPQuery: Query "Your GP Sales Query"; // Your second query for GP data
TempCombinedSales: Record "Your Temporary Table" temporary; // Your temporary table
BCSalesDocType: Enum "Sales Document Type"; // Define the BC Enum type
begin
// Process BC Data (assuming it's already in the correct Enum format)
BCQuery.Open();
while BCQuery.Read() do begin
// Populate TempCombinedSales from BCQuery.
// TempCombinedSales.DocumentType := BCQuery.DocumentType; // Directly assign if BC Query returns Enum
// ... populate other fields ...
// TempCombinedSales.Insert();
end;
BCQuery.Close();
// Process GP Data and translate document types
GPQuery.Open();
while GPQuery.Read() do begin
TempCombinedSales.Init();
// ... populate other fields from GPQuery ...
// Translate GP Document Type (Integer) to BC Enum Value
case GPQuery."GP Document Type Field" of // Assume GPQuery has a field for document type, e.g., an integer
1: BCSalesDocType := BCSalesDocType::Quote;
2: BCSalesDocType := BCSalesDocType::Order;
3: BCSalesDocType := BCSalesDocType::Invoice;
4: BCSalesDocType := BCSalesDocType::"Credit Memo"; // Ensure exact enum member name
else
// Handle unknown GP types if necessary, e.g., set to a default or skip
BCSalesDocType := BCSalesDocType::Order; // Default example
end;
TempCombinedSales.DocumentType := BCSalesDocType;
TempCombinedSales.Insert();
end;
GPQuery.Close();
// Set the page source to the temporary table
CurrPage.SetRecord(TempCombinedSales);
end;
By implementing this CASE
statement within the loop where you read GP data, you directly map the GP numerical values to the corresponding Business Central Enum members before inserting them into your temporary table. This ensures data consistency for display and further processing on your List Page.
✅ Mark this answer as verified if it helps you.
OnOpenPage()
trigger where you read the GP query data, add a CASE
statement (or IF
) to translate the GP values to BC enum values before storing them in your temporary table.
Sohail Ahmed
2,655
Mansi Soni
1,574
YUN ZHU
1,453
Super User 2025 Season 1