Trying to prevent duplicate AP invoices from going through during a VI import. I found a thread on here but it's too old (2019) and it won't let me reply, so I am creating a new one.
@David Overholt created the Perform Logic below with the help of
@Alnoor Cassim. It is exactly what I need for a customer. However, nothing I do seems to make the PL to work. VI simply ignores it with no errors and imports all duplicate invoices. I setup the PL per Davids remarks below. I'm wondering if I need to change something for the newer versions of AP. I am testing on Sage100 Standard 2021.3. Any help would be greatly appreciated.
David's comments and PL from original thread:
I just tested my version and it works. You didn't say what happens. is the perform logic set to run before assign on the field invoice numberyour code looks correct, mine is a little different - I assign "duplicate invoice" to the invoice number so the user can see why it failed, but the logic is the same. below is my code (originally from @Alnoor Cassim)! Prevent duplicate InvoiceNo from being imported into AP_InvoiceHeader! Check AP Invoice History if InvoiceNo already exists for Div and VendorNo! If so, skip to next record! In V/I Import Job set the PERFORM to run on! BEFORE ASSIGN of Header on table AP_InvoiceHeader column InvoiceNo! Command = ..\AP\AP_VISkipDuplicateInvoices.m4p;ENTRY_POINTENTRY_POINT:IF NOT(coInvcHistHdr) {coInvcHistHdr = NEW("AP_InvoiceHistoryHeader_Svc",%SYS_SS)}InvoiceNo$ = var$ ! Field value is passed in for us as var$retExists = coInvcHistHdr'CheckInvoiceHistory(APDivisionNo$, VendorNo$, InvoiceNo$)IF retExists {var$ = "Duplicate Vendor: " + VendorNo$ + " Invc: " + InvoiceNo$! var$+= " Amt: $" + IMP$[n] - optionally add InvoiceAmt from source file. Change n to match column number is source file.! Force dictionary error of length exceeded. Causes Fail entry in Import Job Log.}EXIT
------------------------------
Kenny Daniel
TechnoClarity, Inc.
------------------------------