Jump to content

Chris Hardstaff

Members
  • Posts

    1
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, we noticed that there is at least 1 customer account not included in the retrieval of SalesRecords when running the import for some reason and we aren't sure why. From the whole import, this illustrates the problem, post-import in the database you can see there is no A10006 - the missing account in question In SAGE (N.B. we don't import Inactive accounts) Can see there by comparison that inactive accounts are missing as expected and for some inexplicable reason A10006 which looks OK is omitted from the API call. In order to check further we started using the Find method to figure out if we could 'grab' the missing account. Following the documentation if we run a find for ANY customer code which we know to be present and even imported through to the application we are just returned the first customer account in the list regardless of what we search for. We note that using the find does only bring back the 1 record though, so it's not like it starts iterating through the whole list as it does when we omit the search. It seems the partial find also acts in exactly the same way for some reason. From the documentation: ' ************** Complete Match on Sales Record object ********************** ' Create Sales Record Object Set oSalesRecord = oWS.CreateObject("SalesRecord") ' Populate index field with value to search for oSalesRecord.Fields.Item("ACCOUNT_REF").Value = CStr("CASH001") ' Perform Exact match find bFlag = oSalesRecord.Find(False) If bFlag Then MsgBox "The find has been successful, the object is positioned to " & _ oSalesRecord.Fields.Item("NAME").Value, vbOKOnly Or vbInformation, "SDO" Else MsgBox "The find has not found a match to your criteria", vbOKOnly Or vbInformation, "SDO" End If ' ************** Partial Match on Purchase Record object ******************* ' Create the Purchase Record Object Set oPurchaseRecord = oWS.CreateObject("PurchaseRecord") ' Populate index field with value to search for oPurchaseRecord.Fields.Item("ACCOUNT_REF").Value = CStr("S") ' Perform partial match find bFlag = oPurchaseRecord.Find(True) If bFlag Then MsgBox "The find has been successful, the object is positioned to " & _ oPurchaseRecord.Fields.Item("NAME").Value, vbOKOnly Or vbInformation, "SDO" Else MsgBox "The find has not found a match to your criteria.", vbOKOnly Or vbInformation, "SDO" End If From our code: // Get SAGE definition SalesRecord oRecord = (SalesRecord)Mandatory.Sage50Workspace.CreateObject("SalesRecord"); // Handle specific search if requested bool searchingForSpecificRecord = false; if (custID != null) { searchingForSpecificRecord = true; ConsoleNotification.Notify(ConsoleNotification.MessageType.INFORMATION, $"Specific Customer Account Download Requested {custID}"); // Set filter oRecord.Fields.Item("ACCOUNT_REF").Value = custID; // Lookup in SAGE (import will be as per below within the loop if we get a hit) bool dataToImport = oRecord.Find(false); if (!dataToImport) { ConsoleNotification.Notify(ConsoleNotification.MessageType.ERROR, $"Cannot find Customer Account with Reference {custID} in SAGE"); return new IntegrationActionResult() { Success = false, ErrorMessage = $"Cannot find Customer Account with Reference {custID} in SAGE" }; } } Output result (exact match custID = "P10044") - shows output from lower in the code than the example above - it finds the record and imports but the record is always A10004 Output result (partial match "P") -- shows output from lower in the code than the example above - it finds the record and imports but the record is always A10004 Not sure if there's 1 or 2 problems here. Something seems off in the Find Method but if there's some corruption of the data or something in SAGE it could be the same reason why the account isn't pulled through? We've done a reindex on customers and a compression, we've checked for errors - can't see anything obvious. Anyone got any ideas?
×
×
  • Create New...