Run import scenario only if new file has been synced
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?
Page 1 / 1
@mikeho , that’s a very good question and a very familiar scenario :)
You have a couple options:
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).
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.
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.
@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!
@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.
Hi @mikeho were you able to find a solution? Thank you!
@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.
@Chris Hackett hi - any chance you have a better solution for this need? we want to use the file sync and scheduled process import scenario - but only want the import scenario to run if the file is new. We don’t want to have to worry about numbering systems, and don’t want the data to update itself either.
If that isn’t possible, we were thinking on other ways to trigger the import scenario not necessarily on a schedule but on some other flag that we manage for when to trigger the import scenario. For example, if we monitored the ftp location of where the file will sit, and when there is an update or new file uploaded, we can hit a webhook within acumatica and store that in a custom table. then have a Business Event that will trigger when there are unprocessed files, which would then trigger the import scenario. It’s not ideal as i would have hoped there was a way to more simply handle this within acumatica, so wanted to get your thoughts on it before we decided on our approach.
many thanks in advance.
Hi @ckwiat46 - While I manage the Acumatica Community, I am not a product expert. You may want to pose a new question for the community experts and reference this question.