this is how I have it:
BEGIN
{
“”.SETFILTER(“No.”, ‘<>%1’, “”.“No.”);
“”.SETRANGE(“Chamber of Commerce no.”,"".“Chamber of Commerce no.”);
IF NOT “”.ISEMPTY THEN
ERROR('Number already exists ');
currXMLport.SKIP;
}
“”.SETRANGE(“Chamber of Commerce no.”,"".“Chamber of Commerce no.”);
IF “”.COUNT > 1 THEN
ERROR(‘Kamer van koophandel nummer bestaat al’);
//currXMLport.IMPORTFILE := FALSE;
//currXMLport.QUIT;
BussinesContactName.SETFILTER(BussinesContactName.“No.”,"".“No.” );
IF BussinesContactName.FINDFIRST THEN;
“”.“Country/Region Code” := ‘NL’;
“”.“Fax No.” := Rec.“Fax No.”;
//loops through all the contacts connected with a company contact
WHILE (LoopCount <> 0) DO
BEGIN
IF “”.ISEMPTY THEN
BREAK;
KlantContact.GET(FirstContact);
KlantContact.VALIDATE(KlantContact.“Company No.”, BussinesContactName.“Contact No.”);
IF KlantContact.Website = TRUE THEN
KlantContact.“E-Mail Verification” := 1
ELSE
KlantContact.“E-Mail Verification” := 0;
KlantContact.MODIFY;
LoopCount := LoopCount - 1;
FirstContact := INCSTR(FirstContact);
END;
“”.“Primary Contact No.” := BussinesContactName.“Contact No.”;
//insert the bank account properties
IF IBAN <> ‘’ THEN BEGIN
CustomerBankAccount.“Customer No.”:= “”.“No.”;
CustomerBankAccount.IBAN := (IBAN);
CustomerBankAccount.“SWIFT Code” := (Swift);
IF STRLEN(CustomerBankAccount.IBAN) >= 10 THEN
CustomerBankAccount.Code := COPYSTR(CustomerBankAccount.IBAN,STRLEN(CustomerBankAccount.IBAN)-9,10);
“”.“Bank Account Code” := CustomerBankAccount.Code;
CustomerBankAccount.INSERT(TRUE);
END;
RecRef.GETTABLE("");
//connect the payment method to the TemplateHeader and update the record:
//rekening
TemplateHeader.SETFILTER(TableID, FORMAT(18));
IF TemplateHeader.Code = ‘KNT-KLANT’ THEN
TemplateHeader.SETFILTER(TemplateHeader.Code,‘REK-KLANT’);
//kontant
IF TemplateHeader.Code = ‘REK-KLANT’ THEN
TemplateHeader.SETFILTER(TemplateHeader.Code,‘KNT-KLANT’ );
//automatische incasso
IF TemplateHeader.Code = ‘BIN-INC-KL’ THEN
TemplateHeader.SETFILTER(TemplateHeader.Code,‘BIN-INC-KL’ );
UpdateRecordTemplate.UpdateRecord(TemplateHeader, RecRef);
MESSAGE(ImportKlantText + ’ ’ + “”.“No.”);
//rekening
END;