Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#790765
Basically, I need to add a script task and a wait event in order for the process to keep the case paused until the date of the appointment so I can report on the time spent as well (how long is was paused for, etc)

I have everything setup but I'm stumped on the script part, is there a PMFunction that would suit this?

Image
#790769
If you know the time of the appointment when the case is in the "Schedule Sign & Review" task, then you can use PMFPauseCase(). See this example.

If you don't know the time of the appointment and need to pause the case indefinitely while waiting for the appointment, then you will need to use a loop-around with an intermediate timer event and script task like this:
LooparoundWithScriptTask.png
LooparoundWithScriptTask.png (13.4 KiB) Viewed 3979 times
Your script task will periodically execute a trigger that checks whether the appointment has been set. If so it will set a variable that can be checked in the conditions in your exclusive gateway to either loop around again or continue with the next task.
Your 2 conditions in the gateway would be something like:
Go to Task 2: (!isset(@@continue) or @@continue != 'yes')
Go to Task 3: @@continue == 'yes'

Your trigger in Task2 would be something like:
Code: Select all
//need to set the condition to check if the appointment was set
if (...)  {
   @@continue = 'yes';
}
else {
   @@continue = 'no';
}
if you need to calculate the time, what are you trying to calculate? The time to complete a task, the time between two tasks, the time from the start of the case, the time between two datetime variables? Be more specific.
#790774
amosbatto wrote:If you know the time of the appointment when the case is in the "Schedule Sign & Review" task, then you can use PMFPauseCase(). See this example.

If you don't know the time of the appointment and need to pause the case indefinitely while waiting for the appointment, then you will need to use a loop-around with an intermediate timer event and script task like this:
LooparoundWithScriptTask.png
Your script task will periodically execute a trigger that checks whether the appointment has been set. If so it will set a variable that can be checked in the conditions in your exclusive gateway to either loop around again or continue with the next task.
Your 2 conditions in the gateway would be something like:
Go to Task 2: (!isset(@@continue) or @@continue != 'yes')
Go to Task 3: @@continue == 'yes'

Your trigger in Task2 would be something like:
Code: Select all
//need to set the condition to check if the appointment was set
if (...)  {
   @@continue = 'yes';
}
else {
   @@continue = 'no';
}
if you need to calculate the time, what are you trying to calculate? The time to complete a task, the time between two tasks, the time from the start of the case, the time between two datetime variables? Be more specific.
I am trying to calculate the time to complete the task since ProcessMaker doesn't calculate the time once it is paused if I'm not mistaken. The date will be coming from a calendar plugin. The date will show as AppointmentDate under casesDemo. I'm just not sure how to pull it to check if it has been met. APP_DATA (Array, 12 elements) -> AppointmentDate
Image

currently have:
Code: Select all
// Appointment date
$APP_DATA["AppointmentDate"] = $AppointmentDate;
	
// Today's date
$CurrentDate = date("m/d/y", time());

// Check if appointment date was met
if ($AppointmentDate >= $CurrentDate )  {
   @@DateMet = 'yes';
}
else {
   @@DateMEt = 'no';
}
Is something incorrect with the first syntax?
#790778
If the format of your $AppointmentDate variable is "MM/DD/YYYY", then you need to convert to a timestamp to do the comparison between dates.

Try this:
Code: Select all
// Appointment date
$APP_DATA["AppointmentDate"] = $AppointmentDate;
$appointment = strtotime($AppointmentDate);
$today = strtotime(getCurrentDate());   

// Check if appointment date was met
if ($Appointment >= $today )  {
   @@DateMet = 'yes';
}
else {
   @@DateMet = 'no';
}

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]