Async "Post" Transition Question

0
I am trying to post an item into the AUX table and what to transition primary item to certain state IF user selects certain value. Since post to AUX item run asynchronously the actual primary item may transition before even user has finished entering data value on AUX submit form. How would i then see what user entered and transition primary item when actually AUX item is created with certain value.

Help!!!
Responses (6)
  • Accepted Answer

    Thursday, August 01 2013, 06:38 AM - #Permalink
    0
    A Notification can run a script when an aux table item has been created or modified. The challenge is the inherent (intentional) latency between the item being committed to the DB and the Notification running.

    I think there are too many asynchronous events for this usage case to be viable:

    Multiple users

    User 1 selects primary item "123" in state "New", does a POST to create an aux item, and delays completing the aux item SUBMIT form. Primary item "123" is “waiting” on the aux item.

    User 2 selects primary item "123, does a POST and completes the aux item SUBMIT. The aux item signals the parent primary item to transition to state “B”.

    User 1 completes the aux SUBMIT form. The aux item signals parent "123" to transition from "new" to "A" but it can't because it's already been transitioned to "B"

    Parent item locked

    User does POST via primary item "123" and completes the aux SUBMIT. The primary item is now waiting for the Notification script to run on the aux item and setup the conditions that will cause it to transition

    User edits primary item "123". This item is now locked preventing it from being transitioned by the automation.

    Race condition

    User does POST via primary item "123" and completes the aux SUBMIT.

    User edits the new aux item and corrects the field that determines which state the parent will be transitioned to, just as the Notification runs the script. User clicks OK to update the aux item but by this point the primary item has already been transitioned. The primary item is now in the wrong state based on the updated aux table item.
    The reply is currently minimized Show
  • Accepted Answer

    Michael
    Michael
    Offline
    Friday, August 02 2013, 01:00 AM - #Permalink
    0
    Can't you just have a single relational field on the "main" item referencing the AUX table that is mandatory on a transition and then the selection of the AUX Item drives the next step/state?

    How many items do you expect in that AUX table? Is it necessary to have those items submitted on the fly, or is that more like configuration data (mostly static)? What about changes (deletes) in the AUX table?
    The reply is currently minimized Show
  • Accepted Answer

    Friday, August 02 2013, 06:13 AM - #Permalink
    0
    I already have an multi-relational field on the primary item referencing AUX Item. The AUX table contains user data and there could be about 3-4 AUX item may be more for some primary item.
    The reply is currently minimized Show
  • Accepted Answer

    Michael
    Michael
    Offline
    Friday, August 02 2013, 07:58 AM - #Permalink
    0
    I guess I don't understand what you are trying to achieve.

    As Paul T. pointed out, there are several events that may conflict with each other. You can't have the field/value that drives the transition types on the primary Item?

    How many different types are there?
    The reply is currently minimized Show
  • Accepted Answer

    Friday, August 02 2013, 02:59 PM - #Permalink
    0
    I can't have the Field/value that would drive the decision making on which transition to execute. The problem is how and where do i set this primary item field? for e.g. lets say i create a boolean field in primary item that will help in making decision on which transition to execute but then how would i populate this field and where? Since Post is Async i can't put a script in post-transition also there is no way for me to run a script when an AUX item is actually created in DB. When AUX item is actually getting created that's when i can set this boolean field but SBM do not allow me to hook any script while AUX record is getting created.

    Due to some of the items Paul T mentioned i am not considering using Notification. I am trying to come up with a best possible way to achieve this.
    The reply is currently minimized Show
  • Accepted Answer

    Michael
    Michael
    Offline
    Monday, August 05 2013, 01:40 AM - #Permalink
    0
    From what I understand you are trying to drive an action on the primary table with data posted to a second/aux table. In that case you will always run into potential timing/synchronization issues.

    I would suggest to add the "driving field" to the primary table (keep that hidden except in the "post" transition where it has to be mandatory) and copy that value into the AUX on post (maybe even have that read-only on the AUX submit), that way everything you need is on the primary table and you can use that to trigger the correct transition/action. No notification required, only actions / pre- / post- scripts.
    The reply is currently minimized Show
Your Reply

Recent Tweets