Issue with "Un-import Command
AnsweredHi There - I am running into an issue using the "Un-Import File From Table" Command. The chain this command is in, fetches the file ID of the file in the data table (and after using the Array to CSV and an advance query to get the file ID) un-imports the file and then deletes it. After this is completed the second half of the chain continues and fetches an updated file using the "Run Custom Report" command (for Sage Intacct) and imports the file into the data table.
This issue is, if the second half of the chain does not execute for some reason (ie, the fetching of the new file from the "Run Custom Report" command), then there is no active file in the data table and the next time the chain runs, I get the following error - because it is looking for an imported file to un-import.
I have included a screen shot of our chain below. Is there a way to prevent this? Or a cleaner way to do this? Thanks for any help.
PS - We love chains!
ERROR RECEIVED.
Error: current file status is STAGED but must be one of [IMPORTED, IMPORTING]. Code 400
Result: Error: current file status is STAGED but must be one of [IMPORTED, IMPORTING]. Code 400

-
The error means that the 'Un-import File' command is trying to un-import a file that is already un-imported (staged). This usually happens if the 'Import File into Table' command fails on the previous run of the Chain. There are a couple of things you can do to handle these cases in the future.
First, I'd recommend adding a couple of retry attempts to the Workiva nodes. See step 4 here https://support.workiva.com/hc/en-us/articles/360036003671-Manage-Commands-in-Chains#section4 for a little information on where to find and setup retries. Adding 3 retries with a 15 to 30 second gap can help mitigate any network communication noise.
Second, since the file failed to un-import because it was already in an un-imported state, the 'Delete File' node can still execute to delete and clean up that file. In the 'Delete File' node, rather than getting the File ID from the un-import node output, get the File ID from the Extract Value output (just like you're doing with the Un-import node). This way, if the un-import node fails, 'Delete File' will still attempt the delete as it is no longer relying on the success of the un-import node to get the ID. Alternatively, you could build logic in to extract the status of the file and either add a skip condition to the un-import node or branch using a Conditional node if the file exists and which state it is in.
0Jeff,
How to make the chain go to the next step(Delete File command) when the chain stops at Un-Import File command?
0Hi Srikanth Adi, you'll need to review the logs to see why the unimport node failed and resolve the error. Your Chain is configured such that the Delete File node will only execute if the unimport node is successful. If you need further help with resolving the error, please post the logs here for review. Thanks!
0Jeff, the unimport failed when it was already in unimported stage. I mean sometimes the chain failed during import stage when there was error related to data type problem. So when i re-start the chain, as it was already un-imported during previous run, it fails at this step.
Trying to skip or bypass the un-import if it is already unimported.
0Hi Srikanth Adi, you're correct that you need to skip the unimport step if the file is already in a staged state. A great way to do this is within the node's "Skip conditions". If the status of the file is staged, skip the unimport step and move directly to the Delete File node. Here is more information about Skip conditions https://support.workiva.com/hc/en-us/community/posts/38465202656276-Skip-Conditions-Not-to-Be-Skipped-But-Definitely-Worth-Considering.
0Thanks Jeff. I was able to add the skip condition rule to the Un-import step. It is working now even if the file status was unimported.
Took few tries to understand the correct settings in the rule.
Attaching the screenshots, so easy for others to follow the correct syntax.
0


Comments
8 comments