Insert credit safe rapport

Hi,

I have an XML POrt where you can import clients and there contacts. I have it like this:


BedrijfsInformatie - Import::OnAfterInsertRecord()


BEGIN


BussinesContactName.SETFILTER(BussinesContactName."No.","<Customer>"."No." );
IF BussinesContactName.FINDFIRST THEN;

"<Customer>"."Country/Region Code" := 'NL';
"<Customer>"."Fax No." := Rec."Fax No.";
//loops through all the contacts connected with a company contact
WHILE (LoopCount <> 0) DO
BEGIN

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;

 


"<Customer>"."Primary Contact No." := BussinesContactName."Contact No.";
//insert the bank account properties
IF IBAN <> '' THEN BEGIN
CustomerBankAccount."Customer No.":= "<Customer>"."No.";
CustomerBankAccount.IBAN := (IBAN);
CustomerBankAccount."SWIFT Code" := (Swift);

IF STRLEN(CustomerBankAccount.IBAN) >= 10 THEN
CustomerBankAccount.Code := COPYSTR(CustomerBankAccount.IBAN,STRLEN(CustomerBankAccount.IBAN)-9,10);
"<Customer>"."Bank Account Code" := CustomerBankAccount.Code;
CustomerBankAccount.INSERT(TRUE);
END;
RecRef.GETTABLE("<Customer>");

//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 + ' ' + "<Customer>"."No.");
//rekening
//Link to CreditSafe rapport:
{
//total counter
Total := Total + 1;
ReqCap := ReqCap + 1;

//Create Request
Request.InitSearchRequest();
Request."Link Type" := LinkType::customer;
Request.VALIDATE("Link Code", Customer."No.");

//Test request
IF (NOT (Request.MandatoryFieldsFilled)) THEN
BEGIN
// ERROR('Missende velden!');
CurrReport.SKIP;
END;

IF (ReqCap MOD 19 = 0) THEN
SLEEP(310000);

//Get Response
SOAP.FindCompanies(Request);

//Test Response
IF (NOT Request.ResultExists) THEN
BEGIN
// ERROR('Niets gevonden');
CurrReport.SKIP;
END;

//Link account
//Pick the first response
Response.SETRANGE("User ID", USERID);
Response.SETRANGE("Entry No.", 1);

//MESSAGE('Dinges: %1', Response.COUNT);
IF Response.FIND('-') THEN
BEGIN
IF Response.COUNT = 1 THEN
BEGIN
RetrieveOnlineReportProcess(Response);
//total Counter
TotalFound := TotalFound + 1;
END;
END;

SLEEP(300);
//END link creditSafe
}

CreditFetchRapport.RUN;
CreditFetchRapport.RetrieveOnlineReportProcess();


END;


And I have a Report like this:


Documentation()

Customer - OnPreDataItem()
Total := 0;
TotalFound := 0;
ReqCap := 0;

Customer - OnAfterGetRecord()
//total counter
Total := Total + 1;
ReqCap := ReqCap + 1;

//Create Request
Request.InitSearchRequest();
Request."Link Type" := LinkType::customer;
Request.VALIDATE("Link Code", Customer."No.");

//Test request
IF (NOT (Request.MandatoryFieldsFilled)) THEN
BEGIN
// ERROR('Missende velden!');
CurrReport.SKIP;
END;

IF (ReqCap MOD 19 = 0) THEN
SLEEP(310000);

//Get Response
SOAP.FindCompanies(Request);

//Test Response
IF (NOT Request.ResultExists) THEN
BEGIN
// ERROR('Niets gevonden');
CurrReport.SKIP;
END;

//Link account
//Pick the first response
Response.SETRANGE("User ID", USERID);
Response.SETRANGE("Entry No.", 1);

//MESSAGE('Dinges: %1', Response.COUNT);
IF Response.FIND('-') THEN
BEGIN
IF Response.COUNT = 1 THEN
BEGIN
RetrieveOnlineReportProcess(Response);
//total Counter
TotalFound := TotalFound + 1;
END;
END;

SLEEP(300);

Customer - OnPostDataItem()
MESSAGE('%1 van de %2 gematched en verwerkt.', TotalFound, Total);

RetrieveOnlineReportProcess(SearchResponse : Record "CSA - Search Response")
Setup.Read;

WITH ReportRequest DO BEGIN

CLEAR(ReportRequest);
SETRANGE("User ID",USERID);
DELETEALL(TRUE);

CLEAR(ReportRequest);
"User ID" := USERID;
"Response Entry No." := SearchResponse."Entry No.";
ReportRequest."Creditsafe ID" := SearchResponse."Creditsafe ID";
Country := SearchResponse.Country;
Language := SOAP.CheckSetReportRequestValue(SearchResponse,SearchResponseDetail.Type::AvailableLanguage,Setup."Report Language")
;
"Report Type" := SOAP.CheckSetReportRequestValue(SearchResponse,SearchResponseDetail.Type::AvailableReportType,'Full');
"Request Reason" := Setup."Request Reason";
"Charge Reference" := '';
"Store In Reportbox" := FALSE;
Portfolio := Setup.Portfolio;
INSERT(TRUE);

COMMIT;

REPEAT
MandatoryFieldsOK := TRUE;

MandatoryFields :=
ReportRequest.FIELDCAPTION("Report Type")+', '+
ReportRequest.FIELDCAPTION(Language);
IF (ReportRequest."Report Type" = '') OR (ReportRequest.Language = '') THEN BEGIN
MandatoryFieldsOK := FALSE;
END;
IF (ReportRequest.Country = 'DE') AND (ReportRequest."Request Reason" = 0) THEN BEGIN
MandatoryFieldsOK := FALSE;
MandatoryFields += ', '+ReportRequest.FIELDCAPTION("Request Reason");
END;

IF NOT MandatoryFieldsOK THEN BEGIN
EXIT;
END;
UNTIL MandatoryFieldsOK;

SOAP.RetrieveCompOnlineReport(
ReportRequest."Creditsafe ID",
ReportRequest."Report Type",
ReportRequest.Language,
ReportRequest.Country,
ReportRequest."Request Reason",
ReportRequest."Store In Reportbox",
ReportRequest.Portfolio,
ReportRequest."Charge Reference",
SearchResponse."Link Type",
SearchResponse."Link Code",
FALSE
);
END;


So when I do an import I try to connect the Report to the new Client. I try it like this:

CreditFetchRapport.RUN;
CreditFetchRapport.RetrieveOnlineReportProcess();

But the function: RetrieveOnlineReportProcess(SearchResponse : Record “CSA - Search Response”) needs two parameters.

But wich one I have to use?

Thank you

So I have it now like this:


Request.InitSearchRequest();
//MESSAGE('hallo%1%', Request.InitSearchRequest());
//CreditFetchRapport.RUN;
CreditFetchRapport.RetrieveOnlineReportProcess(Response);

But how to call the function:

Customer - OnAfterGetRecord()

Hi,

I have it now like this:


 //Connect to CreditSafe:
Total := 0;
TotalFound := 0;
ReqCap := 0;
//total counter
Total := Total + 1;
ReqCap := ReqCap + 1;

//Create Request
Request.InitSearchRequest();



//Request."Link Type" := LinkType::'Customer'; //LinkType::customer;
//pick.Type := pick.Type::Person;
//Customer
Request."Link Type" := LinkType::customer;
Request.VALIDATE("Link Code", "<Customer>"."No.");

//Test request
IF (NOT (Request.MandatoryFieldsFilled)) THEN
BEGIN
//  ERROR('Missende velden!');
  //CurrReport.SKIP;
END;

IF (ReqCap MOD 19 = 0) THEN
  SLEEP(310000);

//Get Response
SOAP.FindCompanies(Request);

//Test Response
IF (NOT Request.ResultExists) THEN
BEGIN
//  ERROR('Niets gevonden');
 // CurrReport.SKIP;
END;

//Link account
//Pick the first response
Response.SETRANGE("User ID", USERID);
Response.SETRANGE("Entry No.", 1);

//MESSAGE('Dinges: %1', Response.COUNT);
IF Response.FIND('-') THEN
BEGIN
  IF Response.COUNT = 1 THEN
  BEGIN
  CreditFetchRapport.RetrieveOnlineReportProcess(Response);
    //total Counter
    TotalFound := TotalFound + 1;
  END;
END;

SLEEP(300);

Request.InitSearchRequest();
CreditFetchRapport.RetrieveOnlineReportProcess(Response);

  
    //End insert creditSafe

    //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 + ' ' + "<Customer>"."No.");
    //rekening
    //Link to CreditSafe rapport:
{
Request.InitSearchRequest();
//MESSAGE('hallo%1%', Request.InitSearchRequest());
//CreditFetchRapport.RUN;
CreditFetchRapport.RetrieveOnlineReportProcess(Response);
 }


 END;

But I get on this line:

Request."Link Type" := LinkType::customer;

An error. You have three options. But the option has to be selected as Customer.

and LinkType is of datatype Option

If LinkType is a field in the Request table then try like this:
Request.“Link Type” := Request.LinkType::customer;

Thank you!! it works now:)