[EventSubscriber(ObjectType::Codeunit, Codeunit::"CDS Setup Defaults", OnAfterResetConfiguration, '', true, true)]
local procedure OnAfterResetConfiguration(CDSConnectionSetup: Record "CDS Connection Setup")
var
DataverseTable: Record "CRM Salesorder";
BCTable: Record "Sales Header";
IntegrationFieldMapping: Record "Integration Field Mapping";
IntegrationTableMapping: Record "Integration Table Mapping";
IntegrationTableMappingName: Code[20];
begin
IntegrationTableMapping.SetRange(Name, 'SALESORDER-ORDER');
if IntegrationTableMapping.FindFirst() then begin
IntegrationTableMappingName := IntegrationTableMapping.Name;
IntegrationTableMapping.Validate(Direction, IntegrationTableMapping.Direction::Bidirectional);
IntegrationTableMapping.Validate("Synch. Only Coupled Records", false);
//---field values---
//1.Synched by Integration set const value
InsertIntegrationFieldMapping(
IntegrationTableMappingName,
BCTable.FieldNo(CreatedByIntegration),
DataverseTable.FieldNo(SubmitStatus),
IntegrationFieldMapping.Direction::FromIntegrationTable,
'true', false, false);