Questions and discussion around ProcessMaker 2 documentation
By kuki24
#781155
Hi!! I'm new in this. I try to create I new user with the function PMFCreateUser. So what I do is , create a new dynaform as I attached, then I create a trigger using the function PMFCreateUser() and I put the same parameters :
$var = PMFCreateUser(@@UserID,@@Password,@@Nombre,@@Apellido,@@Email,@@Role);
if ($var == 0)
@@text = 'not created';
else
@@text = 'created';


But doesn't create anything ,I don't know where I can see the message 'not created' or 'created'. so I tried to do something different to know what is the problem, I put this :
$var = PMFCreateUser('HELLO','HELLO','HELLO','HELLO',@@Email,'PROCESSMAKER_OPERTOR');
if ($var == 0)
@@text = 'not created';
else
@@text = 'created';

This time it create the new user but without the email. That's mean that the variables that I put on the dynaform doesn't appear in the trigger. I don't how to solve that.


Thank you very much.
Attachments
registro.png
registro.png (31.98 KiB) Viewed 16167 times
By pfsilva
#781218
Hi kuki24, welcome to the ProcessMaker Forum!.

If your dynaform data is not being reached by your trigger, two things comes to my mind, the first one is that the trigger might be inserted in the wrong place, make sure you insert it after the data collection dynaform step is executed.

For more information about triggers and places where they can be inserted, take a look at the following link:
http://wiki.processmaker.com/index.php/2.0/Triggers

Also make sure the variables you're using match your dynaform text field names, this particular trigger (PMF Create User) is available in the ProcessMaker Trigger Wizard, for more information about using the Wizard, follow this link:
http://wiki.processmaker.com/index.php/ ... the_Wizard

Remember that the @@ variables are case variables, I'd suggest you use php variables as function parameters:
i.e.
Code: Select all
$txtUserId = @@UserID;
$txtPassword = @@Password;
$txtNombre = @@Nombre;
$txtApellido = @@Apellido;
$txtEmail = @@Email;
$txtRole = @@Role;

//Do any necessary validation

//Create the user
$var = PMFCreateUser($txtUserId, $txtPassword, $txtNombre, $txtApellido, $txtEmail, $txtRole);

if ($var == 0) {
   @@text = 'Created';
} else {
   @@text = 'Not created';
}
About the "created", "not created" message, the @@text variable you're using is a case variable, so you'll need a dynaform field to hold it, I would create a second dynaform with a text field named text (as per your code), add it as a second step in your task and you'll see the message after you submit the data collection dynaform.

You can also enable "Debug" mode, for more information about how to enable it and how it can help you, follow this link:
http://wiki.processmaker.com/index.php/ ... Debug_Mode

Give it a try and let me know if it worked out.
By kuki24
#781223
Thank you so much :).

How I can insert more information as photo, phone. I use this code
$result = executeQuery("INSERT INTO USERS (USR_PHONE) " "VALUES('12356') WHERE USR_EMAIL=@@EMAIL");
if ($result == 0)
@@text = 'no insert';
else
@@text = 'insert';

I activated debug mode, doesn't appear anything wrong but doesn't insert the phone number.
By pfsilva
#781240
Hi again, you have errors in your query, so look for the "__ERROR__" row in the ProcessMaker Debugger (located on the right of your screen when you're running a case), click on it, and you'll see the error information at the bottom.

So what's wrong with your query?, well, since you're trying to add more information to an existing user you should use "UPDATE" instead of "INSERT", note that more than one user can have the same email address, so if you use the user email in your WHERE clause you might end up with unwanted results, you can use the username instead.

Like this:
Code: Select all
$result = executeQuery("UPDATE USERS SET USR_PHONE='########' WHERE USR_USERNAME='username'");
Always be cautious when it comes to updating and/or inserting data directly in the database.

PS: The user's photograph is not stored in the database so you can't add it using the executeQuery function.
By kuki24
#781245
You are thr best, I'm soo gracefull, I passed 15days working with that .
How I can put user image with dynaform.?because the user have to upload it when he is registrated in dynaform.

Ps: do have any gmail, skype... to contact with you, I would to contract, you cause I have to do more things and I don't have time, if it's possible, thnk you soo much.
By pfsilva
#781259
Hi kuki24 thanks for the compliment and offer, I really appreciate it and I'm glad my posts helped you, but I currently have a full time job so my extra time is very limited.

On the other hand, I'll be posting regularly on the forum for at least the next two weeks, so if you have any other question feel free to create a new thread, this way more users can take advantage of the information provided.

About Uploading a user picture using a dynaform, as I mentioned before, this data is not stored in the database, so this will be a bit more complex, I'll do some tests and I'll get back to you as soon as I have some news. =)


.
By negarmlk
#828669
pfsilva wrote: Tue Nov 25, 2014 4:51 pm Hi kuki24, welcome to the ProcessMaker Forum!.

If your dynaform data is not being reached by your trigger, two things comes to my mind, the first one is that the trigger might be inserted in the wrong place, make sure you insert it after the data collection dynaform step is executed.

For more information about triggers and places where they can be inserted, take a look at the following link:
http://wiki.processmaker.com/index.php/2.0/Triggers

Also make sure the variables you're using match your dynaform text field names, this particular trigger (PMF Create User) is available in the ProcessMaker Trigger Wizard, for more information about using the Wizard, follow this link:
http://wiki.processmaker.com/index.php/2.0/Triggers#Creating_a_Trigger_with_the_Wizard

Remember that the @@ variables are case variables, I'd suggest you use php variables as function parameters:
i.e.
Code: Select all
$txtUserId = @@UserID;
$txtPassword = @@Password;
$txtNombre = @@Nombre;
$txtApellido = @@Apellido;
$txtEmail = @@Email;
$txtRole = @@Role;

//Do any necessary validation

//Create the user
$var = PMFCreateUser($txtUserId, $txtPassword, $txtNombre, $txtApellido, $txtEmail, $txtRole);

if ($var == 0) {
   @@text = 'Created';
} else {
   @@text = 'Not created';
}
About the "created", "not created" message, the @@text variable you're using is a case variable, so you'll need a dynaform field to hold it, I would create a second dynaform with a text field named text (as per your code), add it as a second step in your task and you'll see the message after you submit the data collection dynaform.

You can also enable "Debug" mode, for more information about how to enable it and how it can help you, follow this link:
http://wiki.processmaker.com/index.php/Processes#Activating_Debug_Mode

Give it a try and let me know if it worked out.
hi,sorry can you give me more information about how to get creat or not creat message with creat second and another dynaform? :!:

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]