Notifications during Task Life Cycle

In most common situations we might across the requirement to have different types of notifications during the life cycle of task.
Example : 1) Trigger Notifications on 30%,70% & 110% of task duration. to stating that task is waiting for accomplish the business needs.
Well that’s it. and we may think to use attached timers around task to get it down, fire on specific due dates on each timers… initially its look so rude to have three attached timers on a task. is in it?

lets begin to analyze it clearly.

"DUE IN" is priority setting for a user task, defines when task will be expected to complete.
based on this value and calculate the TWDate based on 30%, 70% & 110% duration of task.

Well one interesting scenario is to calculate TWDate excluding holidays, Yes count on only business days :).

We will talk about how to do it in another posts. lets assume we done calculation of three specific dates, Lets proceed with the implementation.

You may be interested in one of JS api – tw.system.rescheduleTimer(timerId, time)

Yep, you can reschedule timer by calling this api, passing parameters are timer id and TWDate.

Initialize the flag as shown in figure to capture or track the values of 30%, 70% and 110%. Most probably on Pre-Assignment’s of user task. lets say tw.local.flag = “30”;
pull one timer and attached on user task. and define the timer Id tw.local.timerId = tw.system.step.timer.id; set the custom date on timer, obviously it was calculated 30% due date.
Set the flag script as shown below.
its bit tricky to have set the flag like this, the main intention is. initially we already set the date in a timer for 30%, as per the cycle notification send for 30%task duration again  its set to 70% custom date notification and vice versa by using js api as shown in code

if(tw.local.notifAFPFlag=="30"){
tw.local.notifAFPFlag="70"
}else if(tw.local.notifAFPFlag=="70"){
tw.local.notifAFPFlag="110"
}else if(tw.local.notifAFPFlag=="110"){
tw.local.notifAFPFlag=""
}else{
tw.local.notifAFPFlag="NA";
}

reScheduleForReminders(Number(tw.epv.SLAConstants.DUE_DATE_VALIDATION_FORM),tw.local.timerAFPId,tw.local.notifAFPFlag);

JS function look like in below code.

function reScheduleForReminders(taskDueInHours,timerId,flag){
//var taskDueInHours = taskDueInHours;
if(flag == "30"){
log.info("###--------------->Welcome to 30% task duration<------------###"); var thirtyPercentInHours = Math.ceil(taskDueInHours/100 * 30); log.info("thirtyPercentInHours---->"+thirtyPercentInHours);
var thirtyPercentDate = calcuateBusinessDate(tw.env.TIME_SCHEDULE_NAME,new TWDate(),thirtyPercentInHours,"Hour")
log.info("thirtyPercentDate---->"+thirtyPercentDate);
tw.system.rescheduleTimer(timerId, thirtyPercentDate);
}else if(flag == "70"){
log.info("###--------------->Welcome to 70% task duration<------------###"); var seventyPercentInHours = Math.ceil(taskDueInHours/100 * 70); log.info("seventyPercentInHours---->"+seventyPercentInHours);
var seventyPercentDate = calcuateBusinessDate(tw.env.TIME_SCHEDULE_NAME,new TWDate(),seventyPercentInHours,"Hour")
log.info("seventyPercentDate---->"+seventyPercentDate);
tw.system.rescheduleTimer(timerId, seventyPercentDate);
}else if(flag == "110"){
log.info("###--------------->Welcome to 110% task duration<------------###"); var hundredTenPercentInHours = Math.ceil(taskDueInHours/100 * 110); log.info("hundredTenPercentInHours---->"+hundredTenPercentInHours);
var hundredTenPercentDate = calcuateBusinessDate(tw.env.TIME_SCHEDULE_NAME,new TWDate(),hundredTenPercentInHours,"Hour")
log.info("hundredTenPercentDate---->"+hundredTenPercentDate);
tw.system.rescheduleTimer(timerId, hundredTenPercentDate);
} else{
log.info("###--------------->Welcome Infinite Loop<------------###"); var date=new tw.object.Date(); date.parse("12/31/2099","MM/dd/yyyy"); log.info("reschedule to infinite--date-->"+date);
tw.system.rescheduleTimer(timerId, date);
}
}

0 thoughts on “Notifications during Task Life Cycle

  1. Quentintroft Reply

    Your comment is awaiting moderation.

    You said it adequately..
    http://canadianpharmacyntx.com/
    safe canadian online pharmacies top rated canadian pharmacies online us pharmacy no prior prescription canada pharmacy online
    pharmacy cost comparison
    canadian pharmacies that are legit
    safeway pharmacy
    canadian pharmacies that ship to us
    <a href="http://www.bryandornan.com/index.php/2010/03/organic-search-engine-optimization-converts-better-than-ppc/#comments?form2mailerror&inquiry=Business+Development&fname=HaroldAntek&lname=HaroldAntek&email=haroldLof%40gmail.com&company=google&phone1=88857653237&phone2=85561562982&phone3=86323983594&comments=+Thanks+a+lot.+A+good+amount+of+forum+posts.++http://cialismsnrx.com/+cialis+amphetamines+%3Ca+href=%22http://cialisttk.com/%22%3Ecialis+20mg%3C/a%3E+cialis+biljni+dejstvo+%3Ca+href=http://cialismsnntx.com/%3Egeneric+cialis%3C/a%3E?form2mailerror&inquiry=Business Development&fname=Quentingroow&lname=Quentingroow&email=zittel020eejf@songwriter.net&company=google&phone1=82361635921&phone2=89761155917&phone3=86588259643&comments= Thank you! I enjoy this! http://canadianpharmaciesnnm.com/ canadian online pharmacies online pharmacies of canada online pharmacies no prescription canada pharmaceuticals online buying drugs canada online pharmacy no prescription cialis canadian pharmacy canadian prescription drugstore trusted overseas pharmacies prescription cost comparison“>walmart pharmacy price check
    no prescription pharmacies

Leave a Reply

Your email address will not be published. Required fields are marked *