Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#826285
Dear Amosbatto,

this is what I get when I change the codes:
Code: Select all
array(11) {
  [0]=>
  array(9) {
    ["people_class"]=>
    string(28) "XXXX, XXXX"
    ["pnr_hash"]=>
    string(37) "XXXXXX"
    ["email"]=>
    string(26) "XXXX@XXXXX"
    ["department_display_name"]=>
    string(28) "XXXX, XXX, XXXX" (-> this is where I want to list in the dropdown first.)
    ["function"]=>
    string(15) "XXXX"
    ["given_name"]=>
    string(7) "XXXXX" (-> this is what I want to list second.)
    ["surname"]=>
    string(7) "XXXX" (-> this is what I want to list third.)
    ["department_dn"]=>
    string(78) "ou=XXXX,ou=XXXXX,ou=XXXX,ou=XXXX,o=XXXXXX,c=XX"
    ["dn"]=>
    string(67) "UniMrHash=XXXX,ou=XXXX,ou=XXXX,o=XXXX,c=XXX"
  }
I have just anonymized the data .
#826298
I don't see any error in your code.

As always, you need to break this down to by adding more var_dump() and die(), until you find the problem.
If you do this, do you see the complete names in the array?
Code: Select all
        foreach ( $aUsers as $user ) {
            @=selectDpt[] = array($user['department_dn'], $user['department_display_name']);
            var_dump(@=selectDpt[]);
            @=userList[] = array($run . '', $user['given_name'] .' '. $user['surname']);
            var_dump(@=userList[]); 
            die;
       }
#826311
Dear Amosbatto,

I have revised the codes as you mentioned, but it comes with the following error unfortunately.

Codes:
Selection_756.png
Selection_756.png (45.08 KiB) Viewed 8135 times
Error:
Selection_757.png
Selection_757.png (26.67 KiB) Viewed 8135 times
#826313
Hi again,

when I comment out vardumps and die, then it works but it does not list the department names as well as the users.

Code:
Selection_758.png
Selection_758.png (39.5 KiB) Viewed 8134 times
Error:
Selection_759.png
Selection_759.png (10.5 KiB) Viewed 8134 times
#826336
The point is to see what is in your first set of arrays, but I was just cutting and pasting and not paying attention. You check each thing until you figure out what is the problem.

Do this:
Code: Select all
        foreach ( $aUsers as $user ) {
            @=selectDpt[] = array($user['department_dn'], $user['department_display_name']);
            var_dump(@=selectDpt);
            @=userList[] = array($run . '', $user['given_name'] .' '. $user['surname']);
            var_dump(@=userList); 
            die;
       }
#826349
Dear Amosbatto,

This is what I get with that code: array(1) { [0]=> array(2) { [0]=> string(78) "ou=XXX,ou=HRZ,ou=XXXX,ou=XXXX,o=XXXX,c=XX" [1]=> string(28) "XXXXX" } } array(1) { [0]=> array(2) { [0]=> string(0) "" [1]=> string(15) "XXXXXX" } }

Note: The "X"s were written by me.
Best...
#826350
Hi again,

the following codes allow me to reach the correct path of the data and list the departments and users but they only take the second letter of the string given in the system. I can not list the full departmental name, first name and surname of the users. For example, "n" from "string(28) "University: .." and "o" from string(7) "Johan".
Code: Select all
$username = 'XXXX';
$password = 'XXXX';
$url = "XXXXXXX";

$ch = curl_init();

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);

curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);

curl_close($ch);

if ($result === false) {
    $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    @@error = "Error: HTTP status code: $statusCode\n";
} else {
    $aUsers = json_decode($result, true);
    if (empty($aUsers)) {
        @@error = "No users returned";
    }
    else {
        @=selectDpt = [];
        @=userList = [];
        foreach ( $aUsers as $user ) {
            @=selectDpt[] = array($user['department_display_name']);
            @=userList[] = array($user['given_name'] .' '. $user['surname']);


        }
    }
}
Output:
Selection_761.png
Selection_761.png (9.82 KiB) Viewed 8108 times
#826358
When you run the case in Debug Mode, what are the values of the selectDpt and userList variables in the debugger?

Also, make sure that you are only using the @@selectDpt and @@userList variables in the data variable property of the dropdowns. If you use the same variable for both the dropdown's variable and its data variable, then you will have problems.
#826440
Dear Amosbatto,

I have recently changed the variable and data variable but the result is the same and this time I do not event get access to the data listed in rest api side.

See set ups:
Selection_768.png
Selection_768.png (26.07 KiB) Viewed 7215 times
I have another trigger in the same dynaform to call the user details and it is from the same rest api with similar codes. Does this make any matter?
#826482
Dear Amosbatto,
yesterday I solved the problem after revising variable with different names. The dropdowns are now populated by the correct data coming from the rest side. Thank you for your recommendations. Now I want to assign my second used from the second dropdown that I got name and surname from the rest. I want to use "value based assignment" for that purpose but I could not manage that. Can you recommend me some instructions or samples that I can have a look?
Best...
Erdal Ayan
#826492
erdalayan wrote:Now I want to assign my second used from the second dropdown that I got name and surname from the rest. I want to use "value based assignment" for that purpose but I could not manage that. Can you recommend me some instructions or samples that I can have a look?
The UID of the user needs to be in the variable used by a task with Value Based Assignment.

The variable used by the "Colleague" dropdown box needs to be set to the UID of the user to assign to the task if that same variable is used for Value Based Assignment.
Also remember that all the users who might be set in the variable also need to be in the assignment list for the task.

If you need examples, there are 5 examples here that use Value Based Assignment:
https://www.pmusers.com/index.php/Contr ... g_of_tasks
#826533
The variable that you are using for Value Based Assignment isn't set to the ID of the user to assign to the task.

You need to study this example:
https://www.pmusers.com/index.php/Manua ... _same_task

It shows you how to populate the dropdown box with the users in the assignment list a task and select one to assign to the task.

PS: Next time that you have a question, start a new thread with a new title that reflects the question.

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[…]

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]