Start Timer Event

Hi,

Can i set Start Timer event using process variable? Because i saw only Constant, Parameter and Script only. In Script option, i failed to find the process variable i declared.
Any suggestion/help?

Thank you

Interesting question but variables are only defined AFTER initiation, and by definition a Start Event happens before Initiation so the variables will never be available.

I think a little bit of process rethinking may be necessary.

You could create a new process that uses API’s to change the timer condition for this process. But that’s about it I think.

regards
Seán

Hi @Luqman,

yes I remember the question. Again this is not a simple one process task.

I would break this down into multiple processes with connectors as follows (very simplified):

  1. i’m assuming a column in the database called nextReminderDate (the date of the next reminder)

Process 1: Overnight Batch Process

Start->Script Task->End

Start task is a timer event that executes EVERY DAY at (say) 01:00

the following Connectors are placed on the Script task

Connector 1: Read database for all contracts that are due in 6 months or less (not renewed) and nextReminderDate = today, save in list dueContractsNotRenewedYet
Connector 2: Script

for (integer contractNumber : dueContractsNotRenewedYet){ // for each contract not yet renewed
	Map<String, Serializable> processData = new HashMap<String, Serializable>();
	processData.put("contractNumber", contractNumber);
	...
            //processID is the id of the next process - Send Contract Renewal Reminder to Contract Owner
            ProcessInstance processInstance = processAPI.startProcess(processId, processData);

}

This is the end of Process 1: Overnight Batch Process

Process 2: Send Contract Renewal Reminder to Contract Owner

Start->Script Task->End

Start task is a NORMAL Start Task
There is a DATA variable called contractNumber on Pool Process 2

the following Connectors are placed on the Script task

Connector 1: Read database key = contractNumber to get Contract Details

Connector 2: EMail Script to send email…

Connector 3: UPDATE database key = contractNumber, SET nextReminderDate = nextReminderdate+(1 month)

This is the end of Process 1: Send Contract Renewal Reminder to Contract Owner

This way there is no human interaction, and contracts are sent out according to your requirements. Without having to keep or adjust timers of processes.

This is a normal batch situation that covers all your requirements and will do the necessary for all Contracts.

Hope it helps regards
Seán

Hi @Sean McP, i think u have answered my last question about Timer event. To clarify things up, this is my situation:

  1. I must sent notification email to client prior 6 month before the contract end (1/6/2015)
  2. And let says, after sending the 1st notification(1/12/2014), the client still do not make any action(update contract), the subsequent email notification are send
  3. So, the subsequent email are(1/1/2015),(1/2/2015),(1/3/2015),(1/4/2015) and (1/5/2015)
  4. All the subsequent date are retrieved from database thus i’ll be using connector and hold the data using the following list:

List listA = new ArrayList()
listA.add(0,“1/12/2014”)
listA.add(1,“1/1/2015”)
listA.add(2,“1/2/2015”)
listA.add(3,“1/3/2015”)
listA.add(4,“1/4/2015”)
listA.add(5,“1/5/2015”)

  1. So, that way i’m asking if the Timer Event cant be set using process variable because i’m holding the date in java.util.List but apparently it can’t work like that.
  2. Do anyone have best idea/solution to solve this

*Situation above are described with 1 CONTRACT ONLY. Literally, i’ve many contract to handle

Hi @Sean McP

1.Can you explain more about Connector 2 in Process 1 (Overnight Batch Process)
2. What variable type that i should use to hold the result of this script

Thank you

Hi @luqman,

Not really sure what more I can say…

In fact Process 1 Connector 2 could be combined with Connector 1, but I like to keep functions separate.

Anyway Connector 2, takes the List of contract numbers in variable dueContractsNotRenewedYet and for each contract (list item) starts the second process with a specific contract number.

i.e. for example dueContractsNotRenewedYet =[1,3,5,7,9]

for contract 1, put contractNo = 1, start process2 sending contractNo to the process directly
for contract 3, put contractNo = 3, start process2 sending contractNo to the process directly
etc…

For Process 1 the results I would use are:

Connector 1, the result variable is List dueContractsNotRenewedYet which is a list of contracts yet to be used, used by connector 2.
Connector 2, there are no real results, except maybe an “error condition”, but where would you put it/what would you do with it? In my use I write to log all errors, I do not use Result from this connector and simply delete it from the dialog. You could have a third connector, which emails the daily execution to say it worked or failed, or updates a database with the daily execution success or failure…it depends on your requirement.

For Process 2 the results I would use are:

Connector 1, a MAP of the fields for the email
Connector 2, the result is already there as in the email has been sent, so no result really necessary
Connector 3, possibly an error code for any follow on steps if the database update failed, such as an email to the admin saying…Update failed with error code…

It really depends on your requirements.

Hope this helps,
regards
Seán