The way your data is retrieved

Recently we noticed a bunch of email notification going to folks with outdated information. I’ve checked the mailers in the workflows: information is taken via “Input table/Values/….”. And after some thought I came up with a question: when does the actual database read appears? Is it when the workflow instance is created? or when it is actually fired? You need to keep in mind that there might be workflows that are triggered a few weeks/months down the line after the triggering event..

So I’ve raised this question with Vizual and here is the reply:

“The “Input Table/Values” data is cached at the time the workflow instance is created. Data in a DB reader stage is retrieved when the actual workflow process runs. Therefore, even if the workflow itself does not run for a period of weeks or years after the instance is created, the input data will still relate to the snapshot taken at the time the instance appeared on the queue whereas any info taken from a DB reader will show the current data on the database at runtime.

It is also important to bear in mind that the input table values for any calculated fields will show the picture BEFORE the input record was inserted/updated. This means that for a triggered workflow firing on insert of a new record, the input table values for any calculated fields will be blank. When firing on an update, the input table values for calculated fields will be based upon the old values on the record prior to the update. For this reason, if referring to any calculated fields within a workflow, you should always ensure the values are taken from a DB Reader stage (i.e. read from the database at time of executing the workflow) as opposed to using the input table values. Any other relevant data that may have changed since the instance was created should also be read in the workflow (e.g. employee status may change in the period between creating a workflow instance and running the actual workflow process). “

Basically they say “DO NOT USE Input table/Values METHOD EVER!“. There is such a big potential for bugs in your workflow, I would never use this method again. My new rules are: create simple database reader for every database read you need. This way you will save yourself painful debug session few month down the line, when folks will come to you and claim they are getting incorrect data from the mailers.

Thanks to Vizual for providing such a great documentation about all the bugsfetures they have.

This entry was posted in Admin Console and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.