Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Unanswered

Records not inserting

Posted on by
We have an extension that checks records from a Dataverse table and inserts into an intermediate Business Central table where they are then can transferred to Purchase Journal.
This runs as a job normally however we can also run it manually from a button.
Normal daily process is:
  1. ~ 200 records are created in a batch in Dataverse
  2. The rows get validated that vendor exists, document number doesn't exist etc or error populated and /import/ status not updated.
  3. If there is an error this needs to be resolved an error cleared then reprocessed by the scheduled job or activating via button on page
  4.  When the job is run on schedule we see no issues, owner has super permissions
 
We have an issue where recently non super users only successfully insert about 20 records of the 200. The validation allways works perfectly against all records in the Dataverse table.
The issue seems to be that if a user runs the job manually from the page when it's not refreshed so:
  1. Records being created in Dataverse
  2. User opens that page in Dataverse only a small percentage of the records are visible as not all were created/ready when page opened.
  3. User runs the job from button only visible records get inserted.
  4. Non visible records are updates as /imported/ however are never inserted into Business Central
There are no error in logs.
 
I have made a user refresh the page prior to running the job and they all get inserted without an issue.
 
Here is a snippet of the code any ideas?
 
 
 if CDSWiiseRemittance.FindSet() then
            repeat
                Imported := false;
                ValidateData(CDSWiiseRemittance);
                Clear(D365BCWiiseRemittance);
                if CDSWiiseRemittance.Error_Description = '' then begin
                    D365BCWiiseRemittance.Init();
                    //D365BCWiiseRemittance.TransferFields(CDSWiiseRemittance);
                    //D365BCWiiseRemittance./EntryNo./ := FindEntryNo();
                    D365BCWiiseRemittance.d365_WiiseRemittanceId := CDSWiiseRemittance.d365_WiiseRemittanceId;
                    D365BCWiiseRemittance.statecode := CDSWiiseRemittance.statecode;
                    D365BCWiiseRemittance.statuscode := CDSWiiseRemittance.statuscode;
                    D365BCWiiseRemittance.d365_DocumentNo := CDSWiiseRemittance.d365_DocumentNo;
                    D365BCWiiseRemittance.d365_PostingDate := CDSWiiseRemittance.d365_PostingDate;
                    D365BCWiiseRemittance.d365_DocumentDate := CDSWiiseRemittance.d365_DocumentDate;
                    D365BCWiiseRemittance.d365_DocumentType := CDSWiiseRemittance.d365_DocumentType;
                    D365BCWiiseRemittance.d365_ExternalDocumentNo := CDSWiiseRemittance.d365_ExternalDocumentNo;
                    D365BCWiiseRemittance.d365_AccountType := CDSWiiseRemittance.d365_AccountType;
                    D365BCWiiseRemittance.d365_ABN := CDSWiiseRemittance.d365_ABN;
                    D365BCWiiseRemittance.d365_VendorName := CDSWiiseRemittance.d365_VendorName;
                    D365BCWiiseRemittance.d365_BalAccountType := CDSWiiseRemittance.d365_BalAccountType;
                    D365BCWiiseRemittance.d365_BalAccountNo := CDSWiiseRemittance.d365_BalAccountNo;
                    D365BCWiiseRemittance.d365_ClientCode := CDSWiiseRemittance.d365_ClientCode;
                    D365BCWiiseRemittance.d365_WiiseVendorNumber := CDSWiiseRemittance.d365_WiiseVendorNumber;
                    //D365BCWiiseRemittance.d365_ImportedStatus := CDSWiiseRemittance.d365_ImportedStatus;
                    //D365BCWiiseRemittance.d365_PostedStatus := CDSWiiseRemittance.d365_PostedStatus;
                    D365BCWiiseRemittance.d365_Amount := CDSWiiseRemittance.d365_Amount;
                    D365BCWiiseRemittance.d365_amount_Base := CDSWiiseRemittance.d365_amount_Base;
                    //D365BCWiiseRemittance.Error_Description := CDSWiiseRemittance.error_description;
                    //D365BCWiiseRemittance.d365_Paid := CDSWiiseRemittance.d365_Paid;
                    //D365BCWiiseRemittance.d365_ImportedStatus := true;
                    if not D365BCWiiseRemittance.Insert(true) then
                        CDSWiiseRemittance.d365_ImportedStatus := false
                    else begin
                        CDSWiiseRemittance.d365_ImportedStatus := true;
                        Imported := true;
                    end;
                    //D365BCWiiseRemittance.Modify();
                    if Imported then
                        CDSWiiseRemittance.Modify();
                end else begin
                    CDSWiiseRemittance.d365_ImportedStatus := false;
                    CDSWiiseRemittance.Modify();
                end;
                NewD365BCWiiseRemit.Reset();
                if not NewD365BCWiiseRemit.Get(CDSWiiseRemittance.d365_WiiseRemittanceId) then begin
                    CDSWiiseRemittance.d365_ImportedStatus := false;
                    CDSWiiseRemittance.Modify();
                end;
            until CDSWiiseRemittance.Next() = 0;
    end;
 
Categories:

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,126 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans