I encountered an abnormal behaviour and I a trying to find the root cause of the issue. I am trying to get the details of the document stored in a process variable using document() function in my script task. The document function throws an error saying "The document doesn't exist or has been deleted" when I enable activity chaining before script task, but when I disable activity chaining the process works fine. I assume the issue is with the security privileges of the uploaded document, but I was the one who uploaded the document and my account has the admin privileges.
Discussion posts and replies are publicly visible
Activity chaining is used for two purposes, one for faster process, other for same person to view second screen(UI). I think you need to see how data is capturing in monitoring view. Are you uploading from UI first screen, having same access as document storage folder. Map properly inputs to process variables. As soon as you upload you will get document ID, store in rule input, so that it will reach process variable after submit. Later modify your script task assignment as run as whoever designed the process. Now check properly your script task -> if you are calculating in inputs, then the values will be in activity class parameter for output node of script task.
I think this will help you to find root cause.
Hi Sushma Thank you for the reply :) appreciate your effort. However, In my case, I was able to store the document and document ID in the process variables. The problem was to get the metadata of the document using document() function which doesn't work when I activity chain. Activity chaining is used to override the assignment of the next smart service which is activity chained ( Not limited to only user input task). My Question would be although I am a user with admin privileges I was not able to use the document() function in the script task when I activity chain but when I don't do it it works fine. Run as whoever designed the process also doesn't work because I was the designer and it was throwing an error when I run it.
Are you familiar with the contents of the Notes section on the following documentation pages:?
I may be mistaken, but this could be related to how appian switches over from a temporary file to a permanent one.
But it sounds like you already have the permanent doc Id, so I’m not sure...
It sounds to me like you're hitting a very fun and interesting race condition. It would seem that maybe the activity chain is ramping up the speed just enough that while you have the future permanent ID of the Document record, the ID it will continue using forever, maybe not absolutely everything is fully written about that document before the next node fires off and queries data not entirely written yet.
In computing in general, a lot of very quick operations are sometimes treated as done at the moment they're started in the interest of moving on faster, which is usually harmless. If my theory is correct, you should be able to activity chain to an empty script task, or a script task that does some useless calculation that eats up a few milliseconds, or maybe even a one-second timer node between the document upload and the querying stuff about it, and see if that also fixes the problem.
© 2023 Appian. All rights reserved.