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.
By Thommelise
#825245
Hey, im new here :)

I am in need of help.
I have to populate some dynaforms with some information in my pm table by using a trigger.

The senarion is following:

The user has to change an allready exsisting form, when hen enters, in this case a DNS name, it has to look in the pm table for that name and the fill out the rest of the information.

Hope this is something you can help me out with. :)

Greetings
Thommelise
User avatar
By amosbatto
#825262
Let's say that you have a PM Table named "CLIENTS" and the Dynaform has three text fields with the IDs "dnsName", "firstName" and "lastName".

The "sql" property of the "firstName" field will be:
SELECT FIRST_NAME, FIRST_NAME FROM PMT_CLIENTS WHERE DNS_NAME=@@dnsName

The "sql" property of the "lastName" field will be:
SELECT LAST_NAME, LAST_NAME FROM PMT_CLIENTS WHERE DNS_NAME=@@dnsName

See: https://wiki.processmaker.com/3.1/Dependent_Fields
By Thommelise
#825269
Thanks for the fast response, this helped alot :D

It works when i use it in the sql for each field.
But i have a lot of steps, is it possible to make a trigger that populates all of the steps, so i just have all the code in one place? :)
greetings
Thommelise
Attachments
sql.png
sql.png (4.96 KiB) Viewed 3650 times
User avatar
By amosbatto
#825287
If you want the database query to be based on a changing field in the same Dynaform, then dependent field queries is the only way to do it.

If you know what you are searching for before the Dynaform is displayed, then you can use executeQuery() in a trigger like this:
Code: Select all
$srch = addslashes(@@someField);
$sql = "SELECT FIELDX, FIELDY, FIELDZ FROM MY_TABLE WHERE FIELDA='$srch'";
$result = executeQuery($sql);
if (!empty($result)) {
     @@fieldX = $result[1]['FIELDX'];
     @@fieldY = $result[1]['FIELDY'];
     @@fieldZ = $result[1]['FIELDZ'];
}

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

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