Solved

Run import scenario only if new file has been synced

  • 6 June 2023
  • 7 replies
  • 136 views

Userlevel 5
Badge +1

I have an import scenario that will create sales orders from files added to an FTP server. I can set up an automation schedule to run the import scenario (we need it to import multiple times a day), however it is unpredictable when new order files will be added to the FTP site and I don’t want the import scenario to run if a new file hasn’t been synchronized, otherwise it will create duplicate sales orders in Acumatica.

Anyone have any direction on the best way to go about this?

icon

Best answer by Yuri Karpenko 6 June 2023, 23:29

View original

7 replies

Userlevel 7
Badge +6

@mikeho , that’s a very good question and a very familiar scenario :)

You have a couple options:

  1. Somehow program the source of data (whatever is generating and placing a file on the FTP) to only do it on a set interval (every 15 minutes, for instance), and to only do it for net new orders (delta).
  2. Then you schedule your import to run 1-2 minutes after the expected time the FTP file is updated.

If I understand your issue correctly, duplicate orders might be created because you have autonumbering turned on for this specific order type. If you could get away with the manual numbering, using the order number from your source system, that would take care of duplicate orders. In other words, if you have order ‘12345’ in the source file, and Acumatica would create an order with ‘12345’ order number, then the next time an import runs, it would update the existing order, and not create a duplicate.

If however, you need to use autonumbering for this orders, in the import scenario use, use this for the Order Nbr:

This way, Acumatica will first search for that original order number, and if it’s found, it will update the existing record.

Of course, if you utilize this approach, then one of the steps in your import scenario should be:

I hope this helps.

Userlevel 5
Badge +1

Hi @Yuri Karpenko - thanks for the help! Yes, we do need to use autonumbering so that leaves us with your final option. Can you help clarify what these steps would need to be? Here’s part of my current import scenario that works and builds the order correctly:

 

I found that I had to import the external site order ID into the Acumatica Order Nbr. field in order to get the import scenario to work (the autonumbering overrides this in the end). Are you suggesting I insert your Order Nbr. -> Customer Order Nbr. line below my Order Nbr. line in my screenshot above? Or replace it altogether? I’ve tried both and neither has worked.

Userlevel 7
Badge +6

@mikeho , the approach would be to replace the Field / Action Name in the highlighted row (in your screenshot) from Order Nbr. to Order Nbr. -> Customer Order Nbr.

When you say it doesn’t work, what’s happening? Is it throwing an error? Or is it just duplicating the lines?

Thank you!

Userlevel 5
Badge +1

@Yuri Karpenko - it was throwing an error when I originally tried your suggestion, but I just added the <Action: Cancel>  line between the Order Type and the Order Nbr. -> Customer Order Nbr. line and the import worked.

However, if I prepare and import the scenario again, now instead of creating a duplicate order it duplicates the lines on the same sales order. Per your previous comment, “Acumatica will first search for that original order number, and if it’s found, it will update the existing record.”, so it seems like this is the behavior you were expecting?

What I really need is for the import scenario to check if the order already exists and, if it does, do nothing (don’t create a duplicate order nor add duplicate lines to the existing order).

Have you tried changing the synch type in the import scenario to “incremental”? This will only import changed or new records. So if the old file is still present on the ftp site, it will not be imported into Acumatica.

Userlevel 7
Badge

Hi @mikeho were you able to find a solution? Thank you!

Userlevel 5
Badge +1

@Chris Hackett - I ended up doing as Yuri suggested (running on a set schedule) so I just marked that as the answer. It’s not quite what I was looking for, but it works.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved