ProcessMaker code contributions

Moderators: ArturoRobles, ArturoRobles

By HeshanKaru1994
#824261
A -> B
A and B are two dynaforms, and when A completes an incomplete new record is added to a pm table and if the user click on the previous step that incomplete record should be deleted from the table. How to implement such a occurance

Thank you
User avatar
By amosbatto
#824289
You can add an onclick handler to the "previous step" link to set a value in a hidden field if the user clicks on the "previous step" link. Then a trigger would check if there is a value in the hidden field's variable and use executeQuery() to delete the database record.
For example, this JavaScript could be used:
Code: Select all
$("#dyn_backward").click( function() {
     $("#clickedPrevious").setValue('YES');
});
Where "clickedPrevious" is the ID of a hidden field in your Dynaform.

Then, set the following trigger to fire before your Dynaform A:
Code: Select all
if (@@clickedPrevious == 'YES') {
    @@clickedPrevious = ''; //reset for next time 
    $caseNo = @@APP_NUMBER;
    executeQuery("DELETE FROM MYTABLE WHERE CASE_NO=$caseNo");
} 
The problem is that this solution isn't foolproof, because the user can use also use the Steps menu to return to Dynaform A or simply reopen the case and go to Dynaform A.

You are better off to simply use the following trigger before Dynaform A, so that any possible records are always deleted:
Code: Select all
$caseNo = @@APP_NUMBER;
executeQuery("DELETE FROM MYTABLE WHERE CASE_NO=$caseNo");
disable value in dropdown

Check box is more helpful rather than drop down op[…]

Timeout Not Sending Email

I would like to thank you for the efforts you have[…]

use 'insert into' in a trigger

Is your syntax correct? Shouldn't you be using s[…]

issue with processmaker 3.2

You mean the code in the trigger below? That is t[…]