Relationship between Activity chaining and document() function

Hi,

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.

Any Thoughts?

regards,

Abhishek Gaddam  

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    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.

Reply
  • 0
    Certified Lead Developer

    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.

Children
No Data