Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

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.
By Sicilio
#789800
Hi everyone,

I hope this is the right subforum for my problem. We are currently encountering quite strange behavior of pm. Sometime Processmaker throws a random "task doesn't have a valid user or this variable doesn't exist" error message when assigning the next task based on "value based assignment". Fun fact in the triggerstep "after dynaform" the variable for assignment is always set correctly, and it does work for most of the time..however sometimes not^^

Quick overview of the process:

The idea is that user A selects a couple of users who shall participate in the process , furthermore A enters all data needed into a dynaform. Then a trigger creates new cases (of the same process) for users B-D selected. New Cases start from the 1. task of the process.
Pm Screenshit.PNG
Pm Screenshit.PNG (54.3 KiB) Viewed 3844 times
We do have quite a number of triggers involved from multiple SQL querys (all working perfectly), starting new cases (working fine) to manipulating pdf with a toolkit (working fine).
Key trigger for user assignment is set "before dynaform" and is just "@@beantragender(owner of the process)[email protected]@USER_LOGGED;"

When routing from "enter information" to "print documents" this happens:
webacc.png
webacc.png (23.09 KiB) Viewed 3844 times
"beantragender" has a valid user id in it, I specifically compared the id with the id saved in USERS just to make sure.. furthermore a) all users are in a group assigned to the next task b) every user is separately on the "assigned user " list, just to be absolutely sure...

So there is actually no reason for this error. To make this even more fun: by now this error only occurs when users are at our companys local network, when trying the exact same thing( using all accounts involved ) from home I couldn't reproduce the error.
But wait there is more: it does not affect all users within the companys local network. Some can just navigate through the process as intended. The screenshot above is from a user account which can sometimes get to task 2 in the process.

By now I have no clue what is wrong and how I can fix this..

For now my best guess is that somehow our companys local network is sometimes too slow for processmaker. So PM trys to assign the next user while not having loaded the variables needed. As far as I know the pm instance is running on a VM shared with multiple other users, with most likely pretty bad server-side perfomance. And this is our first process which a) has a lot of variables involved and b) many complex triggers. Could that be an issue?

Thanks in advance for any help you can provide. And sorry for the long text ;)

best regards
Sicilio
By Sicilio
#789805
Hi,
yes I know that. But literally all users on the entire system are a) part of a group which is assigned to the next task and b) separately listed as single users on task assignment. Furthermore the same user sometimes gets this error message and sometimes doesn't get it. So there seems to be no scheme behind this error messages..
As I wrote those users affected by this bug can't get to task 2. But when I try to replicate the bug by using their accounts and doing the exact same order of steps from home I do not get any error message (using their accounts!).

You see why I'm running out of ideas?^^

edit: only difference between my testing which is working fine and them is the ip adress / device used.
User avatar
By amosbatto
#789806
Are you running as "localhost" and your users are using an IP address?

If you don't mind publishing your process on the forum, I will test it to see if I can reproduce the problem. What version of PM are you using?
By Sicilio
#789809
Well there it does get a little difficult, in fact we are a university so that's a complex network system with lan/vpn / public wlan etc..and I do know little about networks.
When testing from home I do have my private IP address or i can connect with VPN on the university network. Just tested it, doesn't make a difference whether I'm using my own IP or VPN. Process works fine.
The server with processmaker is running within the university network.
However our local network at the office is I think somewhat different from that..we are within the same ip range as the server but i suppose on some kind of "sub"network.. but don't hold my feet to the fire about that.
Non of us trys to execute the process as localhost (meaning working directly on the server).

I can upload the process but all tasks / variables / trigger code explanation is written in german. Furthermore there are some parts of the triggers which have absolute links to some resources on our server / use scripts (PDFTK) installed on the server. So I would have to remove those before uploading. Would that somehow corrupt your testing as you are not using a 1:1 copy of the process?

edit: pm version 3.1.2
By Sicilio
#790803
Sorry to bother you but this error still exists and makes using processmaker a real pain.

As of now it seems to be limited to one or maybe two users. Other users can use the process as intended.
Furthermore those errors seem to occur randomly. I have tested the process myself up to 40 times in all imaginable combinations/ variable setups with no error at all. Moreover tests have been made with the affected user accounts, doing the exact same thing users would regularly do. During those tests no errors occurred. Even an exact copy(same data, same users, different time obviously) of a crashed instance didn't crash when we tested it.

In the last weeks we have tried the following to prevent it:
1. increase server performance -- no effect, error still occurs
2. delete and recreate the user accounts affected by the error. -- no effect, error still occurs

In a nutshell I have no idea what the problem is or how to solve it.

Any help you can provide is highly appreciated.

best regards
Sicilio
User avatar
By amosbatto
#790814
Are the users who have this problem imported from LDAP? You might see this error if you have two cases open at the same time in the same web browser. Another reason might be that the login session expired, but ProcessMaker usually catches that problem and redirects back to the login screen.
By Sicilio
#790889
Hi amosbatto, thanks for your answer.

Affected Users aren't imported with LDAP. All accounts are create within processmaker.
The other two reasons can be ruled out too. Today I finally got to see the bug myself. The user has opened a new browser window(opera), logged into processmaker(no other PM Sessions active). Created the first case, task assignment worked --> process worked fine. Then created a case, same data as first case-->error in assignment-->process instance crashed.

I just don't get what could possibly cause this error and what the pattern is.
Task assignment for the next task is a simple "value based assignment" with all pm users/groups included in "active user list". The value "@@beantragender" is retrieved in the 1. task by "@@[email protected]@USER_LOGGED;". According to debugger the variable is properly set when the error occurs.

If it would be caused by faulty trigger code it shouldn't be limited to a certain user or at least the error should appear consistently with the same user / data.

Any further ideas?

Thanks for your effort in advance.

Best regards,
Sicilio
By caesear
#790911
Code: Select all
$nextTaskId = '48010253959112508a89831039444025';
echo $nextTaskId;
@@availableUsers = array();
$d = new Derivation();
$aUsers = $d->getAllUsersFromAnyTask($nextTaskId);
foreach ($aUsers as $userId) {
   $aUserInfo = userInfo($userId);
   $fullName = $aUserInfo['firstname'] . ' ' . $aUserInfo['lastname'] .' ('. $aUserInfo['username'].')';

   @@availableUsers[] = array($userId, $fullName);
}
I want know hao to get $nextTaskid;because i use /api/1.0/workflow/cases/"+app_uid+"/tasks obtain $nextTaskId in js . hao connect js with trigger.I found a function to user @@nexttaskid from dynaform
User avatar
By amosbatto
#790919
caesear wrote: I want know hao to get $nextTaskid;because i use /api/1.0/workflow/cases/"+app_uid+"/tasks obtain $nextTaskId in js . hao connect js with trigger.I found a function to user @@nexttaskid from dynaform
If you want to execute the /api/1.0/workflow/cases/{app_uid}/tasks endpoint using JavaScript in a DynaForm, then see this code example: http://wiki.processmaker.com/3.0/JavaSc ... ing_jQuery

You can also find the Task IDs in a process by running a case with Debug Mode enabled and look at the "TASK" system variable in the debugger. Then copy the ID into your code. The IDs of the tasks will not change, except if you export the process and then import the process and select the option to assign new unique IDs.
By Sicilio
#790921
Hi amosbatto,

I had kind of an epiphany today. As it turns out this error is caused by choosing datefield values other than the default value(initial value set by clicking on the calendar symbol). Out of 40 tries every time I chose a date other than default date the error occurred. Doesn't matter if the value is chosen by menu or typed manually.

This is our datefield configuration, all 4 datefields have the same configuration:
processmakerissue.PNG
processmakerissue.PNG (78.24 KiB) Viewed 3673 times

Triggers working with datefield values(just basic formatting for output documents):
Code: Select all
1. Trigger:
[email protected]@beginnreise;
$reisedatum=date('d.m.Y',strtotime($reise));
@=reisedatum=$reisedatum;

2. Trigger
[email protected]=beginnreise;
[email protected]=endereisedatum;
[email protected]=geschaeftdatumbeginn;
[email protected]=endegeschaeftdatum;
$beginndienstreisedatum=date("d.m.y",strtotime($beginnreise));
$beginndienstreiseuhrzeit=date("H:i",strtotime($beginnreise));

$endedienstreisedatum=date("d.m.y",strtotime($endereisedatum));
$endedienstreiseuhrzeit=date("H:i",strtotime($endereisedatum));

$beginngeschaeftdatum=date("d.m.y",strtotime($geschaeftdatumbeginn));
$beginngeschaeftuhrzeit=date("H:i",strtotime($geschaeftdatumbeginn));

$endegeschaeftdatum=date("d.m.y",strtotime($endegeschaeftdatum1));
$endegeschaeftuhrzeit=date("H:i",strtotime($endegeschaeftdatum1));
I tried deleting the datefields and creating new ones with standard configuration. Error keeps popping up as soon as you enter anything else than the default value.

Any idea what causes this behavior? Or how I can fix this?

Thanks in advance.
Best regards
Sicilio
User avatar
By amosbatto
#790922
If you try to pass a date in the format 'd.m.Y' to a datetime control in a DynaForm or try to save it to a MySQL datetime field, you will probably get errors. How are you using those variables like $beginndienstreisedatum which you set in your trigger?
By Sicilio
#790965
Hi amosbatto,
those php variables are used to fill a pdf form with pdftk. They are not saved as processvariables.
It seems to me like processmaker somehow has a problem processing /storing the dynaform information /input. Any idea what could cause such a behavior?

hi everybody , please help me to solve this proble[…]

There's no way to do that. The only way to do so i[…]

Hello, If you are using a version of ProcessMak[…]

I really appreciate the work you did. I got to kno[…]