I'm trying to create Custom field /Order Type/ in sales order page for BC-CRM Integration. created custom fields in both BC and CRM and run alproxy generator and wrote a code like this. I couldn't able to achieve mapping. where I'm missing things? Could you please assist me to build custom field integration?
tableextension 50143 OrderExt extends /CRM Salesorder/
{
Description = 'Quote that has been accepted.';
fields
{
field(10142; /Order Type/; Option)
{
ExternalName = 'ordertype';
ExternalType = 'Picklist';
Description = '';
Caption = 'Order Type';
InitValue = / /;
OptionMembers = / /,/Fixed Bid/,/Time & Material/;
OptionOrdinalValues = -1, 1, 2;
}
}
}
pageextension 50142 /CRM Sales Order Page Extn/ extends /CRM Sales Order List/
{
layout
{
addafter(Name)
{
field(/Order Type/; Rec./Order Type/)
{
ApplicationArea = All;
}
}
}
}
pageextension 50140 /Sales Order Type Page Ext/ extends /Sales Order/
{
layout
{
addafter(/External Document No./)
{
field(/Order Type/; Rec./Order Type/)
{
Caption = 'Order Type';
ApplicationArea = All;
}
codeunit 50149 /Order Type custom field int/
{
[EventSubscriber(ObjectType::Codeunit, Codeunit::/CRM Setup Defaults/, 'OnBeforeResetSalesOrderMapping', '', false, false)]
local procedure OTOnBeforeResetBidirectionalSalesOrderMapping(IntegrationTableMappingName: Code[20])
var
IntegrationFieldMapping: Record /Integration Field Mapping/;
Salesheader: Record /Sales Header/;
CRMsalesOrder: Record /CRM Salesorder/;
begin
IntegrationFieldMapping.CreateRecord(IntegrationTableMappingName, Salesheader.FieldNo(/Order Type/), CRMsalesOrder.FieldNo(/Order Type/), IntegrationFieldMapping.Direction::ToIntegrationTable, '', true, false);
end;
}