The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Articles
Read more about TIBCO use cases, product features, capabilities and more
  • Showing SLA duration for each work item and updating the same in small intervals


    Sucheta S

    This is my first blog. Any suggestions are welcome



    Prerequisite : Basic knowledge of TIBCO BPM



    Story:

    For one of our clients we were required to have the SLA to be shown for each task that were provided to them.

    That part was easy the hard part was updating them in specific intervals eg : hourly basis

    Inital Solution Thought:

    The requirement can be fulfilled by having an external system like a cron job and have it updated but having it done for all the work items would make the solution even more tedious, As we would require to update the list of work items in external system.



    Final Solution: 

    Initial we need to have the current date time with the addition of the SLA duration  stored as an work item attribute say w1 and another work item attribute which will be having the most updated time  say w2 After which the work item will be escalated 

    For having the work item updated in specific intervals we decided to have a timer task intermediate event on the user task 

    We can keep it continue task on timeout and also it would be cyclic

    https://docs.tibco.com/pub/amx-bpm/4.3.0/doc/html/bpmhelp/GUID-6B3CDCE6-...

    Updating the task attributes on cyclic timeout

    https://docs.tibco.com/pub/amx-bpm/4.3.0/doc/html/bpmhelp/GUID-FD0CD379-...

    //--------------------------------------

    Log.write("Schedule Script");

    WorkManagerFactory.getWorkItem().workItemAttributes.attribute6=SLADateTime;

    var today=DateTimeUtil.createDatetime();

    var duration=ScriptUtil.subtract(SLADateTime,today);

    WorkManagerFactory.getWorkItem().workItemAttributes.attribute2=duration.getDays()+" Days and "+duration.getHours()+" Hours and "+duration.getMinutes()+"Minutes";

    //--------------------------------------

    The schedule script for  task is executed once and so is the case with initiate script they are not designed to get repeated.

    They can be executed again and again but that would mean withdrawal of work item which would be generating new work item with updated data instead of updating the same work item.

    To solve that we took the help of reschedule Script 

    https://docs.tibco.com/pub/amx-bpm/4.3.0/doc/html/bpmhelp/GUID-DA2025E1-...

    When the timer expires it executes the reschedule Script associated with the work item.

    That was what we thought

    However this solution did not work as the reschedule task call did not execute 

    To have the cyclic nature and having the reschedule Script executed we took the help of throw and catch event 

    <<link to throw and catch events>>

    On cyclic timeout we can have a transition to throw event which would have the catch event on the same work item with condition of continue on timeout.

    This would trigger the reschedule script as we were expecting to trigger in cyclic time periods

    In the reschedule Script We would subtract the current date time from w1 and obtain the time in let's say hours and store it in w2.

    //------------------------------------------

    Log.write("Reschedule Script");

    //WorkManagerFactory.getWorkItem().workItemAttributes.attribute6=SLADateTime;

    var today=DateTimeUtil.createDatetime();

    var duration=ScriptUtil.subtract(SLADateTime,today);

    WorkManagerFactory.getWorkItem().workItemAttributes.attribute2=duration.getDays()+" Days and "+duration.getHours()+" Hours and "+duration.getMinutes()+"Minutes";

    //----------------------------------------

    Hence the overall solution would look like this

    Project_ScreenShot.png

    The client was using one of the out of the box BPM clients hence we had provided them with openspace.

    In the open space we can add the w2 as a column.

    You can start an instance and  see a work item with w2 showing actual duration left.

    This duration will get updated (in our example every minute which is too frequent however for demo purpose we have kept it like this)



    Conclusion: we have a work item for which it's having the actual duration left for it to expire

    Please note : for actual withdrawal of task you can have another timer with w1 as time to expire and withdraw on timeout radio button selected.

    Kindly find the project for reference

    Limitation for this solution was the load on engine would be high if there are many work items that are active at a time.

    projectscreenshot.png.7024af4271facf6bb9a074d8a9381f00.png

    projectsla.zip


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...