Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

User avatar
By mk8800
#795888
amosbatto wrote:
marcosfpa wrote: I'm having trouble setting up and using subprocesses. Use version 3.1.3. What happens is that I create a normal process and in the middle of it there is a subprocess call and after it the main process goes on with tasks and so on. But when my case arrives in the subprocess it creates the normal subprocess task and at the same time already creates the task that would be after the subprocess, I have already tried to set up the subprocess as Synchronous and Asynchronous and nothing. .
What can it be?
Marcos, I can't replicate this problem using PM 3.1.3 Community Edition. If the subprocess is Asynchronous then I see both the master process case and the subprocess case in the inbox, which is the way it should be. If the subprocess is Synchronous, then I only see the subprocess case. Once the subprocess case finishes, then I see just the master process case in my inbox, which is the way it should be. Attached are the two processes I used:
test_process_with_subprocess-1.pmx
Subprocess-1.pmx
Marcos, if you are seeing something different please provide screenshots and your process so we can test it.
mauromero wrote:I have the same problem. Every time the flow goes into the subprocess task, In the inbox I have the subprocess which it's only a button to go to the first task of the subprocess, and I also have the first task of the subprocess in my inbox. But also, when I click the button in the subprocess, it duplicates the first task. So I now in my inbox I have 2 first tasks of the subprocess.
Mauromero, I don't see the duplicate first task. Can you provide screenshots and upload your process, so the developers can test it.
The problem is back in Version 3.2 and it insert two records to app_cache_view. One for main process and one for sub process.
User avatar
By mk8800
#795922
After a lot of digging and comparing files and database of different versions of PM it seems the problem found and probably solved. It sources from removing a line of a database trigger.

To solve problem edit `APP_DELEGATION_INSERT` trigger and add
Code: Select all
IF( @TAS_TYPE != 'SUBPROCESS') THEN
and
Code: Select all
END IF;
before and after of insert block. The final trigger code should be :
Code: Select all
BEGIN
  DECLARE DEFAULT_LANG VARCHAR(2);
  DECLARE APP_NUMBER INT;
  DECLARE APP_STATUS VARCHAR(32);
  DECLARE APP_CREATE_DATE DATETIME;
  DECLARE APP_UPDATE_DATE DATETIME;
  DECLARE APP_TITLE VARCHAR(255);
  DECLARE APP_PRO_TITLE VARCHAR(255);
  DECLARE APP_TAS_TITLE VARCHAR(255);
  DECLARE APP_CURRENT_USER VARCHAR(255);
  DECLARE PREVIOUS_USR_UID VARCHAR(32);
  DECLARE APP_DEL_PREVIOUS_USER VARCHAR(255);
  DECLARE APP_THREAD_STATUS VARCHAR(32);
  SET @DEFAULT_LANG = 'en';
  SET @APP_CURRENT_USER = '';
  SELECT APPLICATION.APP_NUMBER into @APP_NUMBER FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_STATUS into @APP_STATUS FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_CREATE_DATE into @APP_CREATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_UPDATE_DATE into @APP_UPDATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;

  SELECT APPLICATION.APP_TITLE into @APP_TITLE FROM APPLICATION WHERE NEW.APP_UID=APPLICATION.APP_UID LIMIT 1;
  IF ( @APP_TITLE IS NULL ) THEN
    SET @APP_TITLE = '';
  END IF;
  SELECT PROCESS.PRO_TITLE into @APP_PRO_TITLE FROM PROCESS WHERE NEW.PRO_UID=PROCESS.PRO_UID LIMIT 1;
  SELECT TASK.TAS_TITLE into @APP_TAS_TITLE FROM TASK WHERE NEW.TAS_UID=TASK.TAS_UID LIMIT 1;
  SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_CURRENT_USER FROM USERS WHERE USR_UID = NEW.USR_UID LIMIT 1;
  IF ( @APP_CURRENT_USER IS NULL ) THEN
    SET @APP_CURRENT_USER = '';
  END IF;
  IF ( NEW.DEL_PREVIOUS > 0 ) THEN
    SELECT USR_UID INTO @PREVIOUS_USR_UID FROM APP_DELEGATION WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
    SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_DEL_PREVIOUS_USER FROM USERS WHERE USR_UID = @PREVIOUS_USR_UID LIMIT 1;
    IF ( @APP_DEL_PREVIOUS_USER IS NULL ) THEN
      SET @APP_DEL_PREVIOUS_USER = '';
    END IF;
  ELSE
    SET @APP_DEL_PREVIOUS_USER = '';
    SET @PREVIOUS_USR_UID = '';
  END IF;
  SELECT APP_THREAD_STATUS INTO @APP_THREAD_STATUS FROM APP_THREAD WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
  IF ( @APP_THREAD_STATUS IS NULL ) THEN
    SET @APP_THREAD_STATUS = 'OPEN';
  END IF;
  SET @TAS_TYPE = (SELECT TAS_TYPE FROM TASK WHERE TAS_UID = NEW.TAS_UID LIMIT 1);
  IF( @TAS_TYPE != 'SUBPROCESS') THEN
  UPDATE APP_CACHE_VIEW SET DEL_LAST_INDEX = 0 WHERE APP_UID = NEW.APP_UID;
    INSERT INTO `APP_CACHE_VIEW`  (
    APP_UID,
    DEL_INDEX,
    APP_NUMBER,
    APP_STATUS,
    USR_UID,
    PREVIOUS_USR_UID,
    TAS_UID,
    PRO_UID,
    DEL_DELEGATE_DATE,
    DEL_INIT_DATE,
    DEL_FINISH_DATE,
    DEL_TASK_DUE_DATE,
    DEL_RISK_DATE,
    DEL_THREAD_STATUS,
    APP_THREAD_STATUS,
    APP_TITLE,
    APP_PRO_TITLE,
    APP_TAS_TITLE,
    APP_CURRENT_USER,
    APP_DEL_PREVIOUS_USER,
    DEL_PRIORITY,
    DEL_DURATION,
    DEL_QUEUE_DURATION,
    DEL_DELAY_DURATION,
    DEL_STARTED,
    DEL_FINISHED,
    DEL_DELAYED,
    APP_CREATE_DATE,
    APP_FINISH_DATE,
    APP_UPDATE_DATE,
    APP_OVERDUE_PERCENTAGE,
    DEL_LAST_INDEX
  )
  VALUES (
    NEW.APP_UID,
    NEW.DEL_INDEX,
    @APP_NUMBER,
    @APP_STATUS,
    NEW.USR_UID,
    @PREVIOUS_USR_UID,
    NEW.TAS_UID,
    NEW.PRO_UID,
    NEW.DEL_DELEGATE_DATE,
    NEW.DEL_INIT_DATE,
    NEW.DEL_FINISH_DATE,
    NEW.DEL_TASK_DUE_DATE,
    NEW.DEL_RISK_DATE,
    NEW.DEL_THREAD_STATUS,
    @APP_THREAD_STATUS,
    @APP_TITLE,
    @APP_PRO_TITLE,
    @APP_TAS_TITLE,
    @APP_CURRENT_USER,
    @APP_DEL_PREVIOUS_USER,
    NEW.DEL_PRIORITY,
    NEW.DEL_DURATION,
    NEW.DEL_QUEUE_DURATION,
    NEW.DEL_DELAY_DURATION,
    NEW.DEL_STARTED,
    NEW.DEL_FINISHED,
    NEW.DEL_DELAYED,
    @APP_CREATE_DATE,
    NULL,
    @APP_UPDATE_DATE,
    NEW.APP_OVERDUE_PERCENTAGE,
    NEW.DEL_LAST_INDEX
  );
  END IF;
END
User avatar
By amosbatto
#795929
mk8800, You are a genius! I looked in the PM source code, but I forgot about the MySQL triggers. I will tell the developers to look at your code change.

Thanks for your help.
By marcosfpa
#795936
Could it explain better which code file exactly should I change?
I would like to resolve this issue in my installation before the developers because we do not know how long they will take ...
User avatar
By amosbatto
#795940
marcosfpa wrote:Could it explain better which code file exactly should I change?
I would like to resolve this issue in my installation before the developers because we do not know how long they will take ...
Marcos,
1. Open PhpMyAdmin by going to http://your-address/phpmyadmin in your web browser.
2. Login as the the "root" user.
3. Then, go to the database for your workspace which is named "wf_workflow" by default.
4. Go to the APP_DELEGATION table.
5. In the top level menu, select More > Triggers.
Triggers_For_APP_DELEGATION_table.png
Triggers_For_APP_DELEGATION_table.png (224.6 KiB) Viewed 2349 times
6. Then, click on the "edit" link for the APP_DELEGATION_INSERT trigger:
Edit_APP_DELEGATION_INSERT_trigger.png
Edit_APP_DELEGATION_INSERT_trigger.png (65.57 KiB) Viewed 2349 times
7. In the dialog box that appears:
EditTriggerAPP_DELEGATION_INSERT.png
EditTriggerAPP_DELEGATION_INSERT.png (45.51 KiB) Viewed 2349 times
Replace this trigger code:
Code: Select all
BEGIN
  DECLARE DEFAULT_LANG VARCHAR(2);
  DECLARE APP_NUMBER INT;
  DECLARE APP_STATUS VARCHAR(32);
  DECLARE APP_CREATE_DATE DATETIME;
  DECLARE APP_UPDATE_DATE DATETIME;
  DECLARE APP_TITLE VARCHAR(255);
  DECLARE APP_PRO_TITLE VARCHAR(255);
  DECLARE APP_TAS_TITLE VARCHAR(255);
  DECLARE APP_CURRENT_USER VARCHAR(255);
  DECLARE PREVIOUS_USR_UID VARCHAR(32);
  DECLARE APP_DEL_PREVIOUS_USER VARCHAR(255);
  DECLARE APP_THREAD_STATUS VARCHAR(32);
  SET @DEFAULT_LANG = 'en';
  SET @APP_CURRENT_USER = '';
  SELECT APPLICATION.APP_NUMBER into @APP_NUMBER FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_STATUS into @APP_STATUS FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_CREATE_DATE into @APP_CREATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_UPDATE_DATE into @APP_UPDATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;

  SELECT APPLICATION.APP_TITLE into @APP_TITLE FROM APPLICATION WHERE NEW.APP_UID=APPLICATION.APP_UID LIMIT 1;
  IF ( @APP_TITLE IS NULL ) THEN
    SET @APP_TITLE = '';
  END IF;
  SELECT PROCESS.PRO_TITLE into @APP_PRO_TITLE FROM PROCESS WHERE NEW.PRO_UID=PROCESS.PRO_UID LIMIT 1;
  SELECT TASK.TAS_TITLE into @APP_TAS_TITLE FROM TASK WHERE NEW.TAS_UID=TASK.TAS_UID LIMIT 1;
  SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_CURRENT_USER FROM USERS WHERE USR_UID = NEW.USR_UID LIMIT 1;
  IF ( @APP_CURRENT_USER IS NULL ) THEN
    SET @APP_CURRENT_USER = '';
  END IF;
  IF ( NEW.DEL_PREVIOUS > 0 ) THEN
    SELECT USR_UID INTO @PREVIOUS_USR_UID FROM APP_DELEGATION WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
    SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_DEL_PREVIOUS_USER FROM USERS WHERE USR_UID = @PREVIOUS_USR_UID LIMIT 1;
    IF ( @APP_DEL_PREVIOUS_USER IS NULL ) THEN
      SET @APP_DEL_PREVIOUS_USER = '';
    END IF;
  ELSE
    SET @APP_DEL_PREVIOUS_USER = '';
    SET @PREVIOUS_USR_UID = '';
  END IF;
  SELECT APP_THREAD_STATUS INTO @APP_THREAD_STATUS FROM APP_THREAD WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
  IF ( @APP_THREAD_STATUS IS NULL ) THEN
    SET @APP_THREAD_STATUS = 'OPEN';
  END IF;
  SET @TAS_TYPE = (SELECT TAS_TYPE FROM TASK WHERE TAS_UID = NEW.TAS_UID LIMIT 1);
  UPDATE APP_CACHE_VIEW SET DEL_LAST_INDEX = 0 WHERE APP_UID = NEW.APP_UID;
    INSERT INTO `APP_CACHE_VIEW`  (
    APP_UID,
    DEL_INDEX,
    APP_NUMBER,
    APP_STATUS,
    USR_UID,
    PREVIOUS_USR_UID,
    TAS_UID,
    PRO_UID,
    DEL_DELEGATE_DATE,
    DEL_INIT_DATE,
    DEL_FINISH_DATE,
    DEL_TASK_DUE_DATE,
    DEL_RISK_DATE,
    DEL_THREAD_STATUS,
    APP_THREAD_STATUS,
    APP_TITLE,
    APP_PRO_TITLE,
    APP_TAS_TITLE,
    APP_CURRENT_USER,
    APP_DEL_PREVIOUS_USER,
    DEL_PRIORITY,
    DEL_DURATION,
    DEL_QUEUE_DURATION,
    DEL_DELAY_DURATION,
    DEL_STARTED,
    DEL_FINISHED,
    DEL_DELAYED,
    APP_CREATE_DATE,
    APP_FINISH_DATE,
    APP_UPDATE_DATE,
    APP_OVERDUE_PERCENTAGE,
    DEL_LAST_INDEX
  )
  VALUES (
    NEW.APP_UID,
    NEW.DEL_INDEX,
    @APP_NUMBER,
    @APP_STATUS,
    NEW.USR_UID,
    @PREVIOUS_USR_UID,
    NEW.TAS_UID,
    NEW.PRO_UID,
    NEW.DEL_DELEGATE_DATE,
    NEW.DEL_INIT_DATE,
    NEW.DEL_FINISH_DATE,
    NEW.DEL_TASK_DUE_DATE,
    NEW.DEL_RISK_DATE,
    NEW.DEL_THREAD_STATUS,
    @APP_THREAD_STATUS,
    @APP_TITLE,
    @APP_PRO_TITLE,
    @APP_TAS_TITLE,
    @APP_CURRENT_USER,
    @APP_DEL_PREVIOUS_USER,
    NEW.DEL_PRIORITY,
    NEW.DEL_DURATION,
    NEW.DEL_QUEUE_DURATION,
    NEW.DEL_DELAY_DURATION,
    NEW.DEL_STARTED,
    NEW.DEL_FINISHED,
    NEW.DEL_DELAYED,
    @APP_CREATE_DATE,
    NULL,
    @APP_UPDATE_DATE,
    NEW.APP_OVERDUE_PERCENTAGE,
    NEW.DEL_LAST_INDEX
  );
END
With this code:
Code: Select all
BEGIN
  DECLARE DEFAULT_LANG VARCHAR(2);
  DECLARE APP_NUMBER INT;
  DECLARE APP_STATUS VARCHAR(32);
  DECLARE APP_CREATE_DATE DATETIME;
  DECLARE APP_UPDATE_DATE DATETIME;
  DECLARE APP_TITLE VARCHAR(255);
  DECLARE APP_PRO_TITLE VARCHAR(255);
  DECLARE APP_TAS_TITLE VARCHAR(255);
  DECLARE APP_CURRENT_USER VARCHAR(255);
  DECLARE PREVIOUS_USR_UID VARCHAR(32);
  DECLARE APP_DEL_PREVIOUS_USER VARCHAR(255);
  DECLARE APP_THREAD_STATUS VARCHAR(32);
  SET @DEFAULT_LANG = 'en';
  SET @APP_CURRENT_USER = '';
  SELECT APPLICATION.APP_NUMBER into @APP_NUMBER FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_STATUS into @APP_STATUS FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_CREATE_DATE into @APP_CREATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_UPDATE_DATE into @APP_UPDATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;

  SELECT APPLICATION.APP_TITLE into @APP_TITLE FROM APPLICATION WHERE NEW.APP_UID=APPLICATION.APP_UID LIMIT 1;
  IF ( @APP_TITLE IS NULL ) THEN
    SET @APP_TITLE = '';
  END IF;
  SELECT PROCESS.PRO_TITLE into @APP_PRO_TITLE FROM PROCESS WHERE NEW.PRO_UID=PROCESS.PRO_UID LIMIT 1;
  SELECT TASK.TAS_TITLE into @APP_TAS_TITLE FROM TASK WHERE NEW.TAS_UID=TASK.TAS_UID LIMIT 1;
  SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_CURRENT_USER FROM USERS WHERE USR_UID = NEW.USR_UID LIMIT 1;
  IF ( @APP_CURRENT_USER IS NULL ) THEN
    SET @APP_CURRENT_USER = '';
  END IF;
  IF ( NEW.DEL_PREVIOUS > 0 ) THEN
    SELECT USR_UID INTO @PREVIOUS_USR_UID FROM APP_DELEGATION WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
    SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_DEL_PREVIOUS_USER FROM USERS WHERE USR_UID = @PREVIOUS_USR_UID LIMIT 1;
    IF ( @APP_DEL_PREVIOUS_USER IS NULL ) THEN
      SET @APP_DEL_PREVIOUS_USER = '';
    END IF;
  ELSE
    SET @APP_DEL_PREVIOUS_USER = '';
    SET @PREVIOUS_USR_UID = '';
  END IF;
  SELECT APP_THREAD_STATUS INTO @APP_THREAD_STATUS FROM APP_THREAD WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
  IF ( @APP_THREAD_STATUS IS NULL ) THEN
    SET @APP_THREAD_STATUS = 'OPEN';
  END IF;
  SET @TAS_TYPE = (SELECT TAS_TYPE FROM TASK WHERE TAS_UID = NEW.TAS_UID LIMIT 1);
  IF( @TAS_TYPE != 'SUBPROCESS') THEN
  UPDATE APP_CACHE_VIEW SET DEL_LAST_INDEX = 0 WHERE APP_UID = NEW.APP_UID;
    INSERT INTO `APP_CACHE_VIEW`  (
    APP_UID,
    DEL_INDEX,
    APP_NUMBER,
    APP_STATUS,
    USR_UID,
    PREVIOUS_USR_UID,
    TAS_UID,
    PRO_UID,
    DEL_DELEGATE_DATE,
    DEL_INIT_DATE,
    DEL_FINISH_DATE,
    DEL_TASK_DUE_DATE,
    DEL_RISK_DATE,
    DEL_THREAD_STATUS,
    APP_THREAD_STATUS,
    APP_TITLE,
    APP_PRO_TITLE,
    APP_TAS_TITLE,
    APP_CURRENT_USER,
    APP_DEL_PREVIOUS_USER,
    DEL_PRIORITY,
    DEL_DURATION,
    DEL_QUEUE_DURATION,
    DEL_DELAY_DURATION,
    DEL_STARTED,
    DEL_FINISHED,
    DEL_DELAYED,
    APP_CREATE_DATE,
    APP_FINISH_DATE,
    APP_UPDATE_DATE,
    APP_OVERDUE_PERCENTAGE,
    DEL_LAST_INDEX
  )
  VALUES (
    NEW.APP_UID,
    NEW.DEL_INDEX,
    @APP_NUMBER,
    @APP_STATUS,
    NEW.USR_UID,
    @PREVIOUS_USR_UID,
    NEW.TAS_UID,
    NEW.PRO_UID,
    NEW.DEL_DELEGATE_DATE,
    NEW.DEL_INIT_DATE,
    NEW.DEL_FINISH_DATE,
    NEW.DEL_TASK_DUE_DATE,
    NEW.DEL_RISK_DATE,
    NEW.DEL_THREAD_STATUS,
    @APP_THREAD_STATUS,
    @APP_TITLE,
    @APP_PRO_TITLE,
    @APP_TAS_TITLE,
    @APP_CURRENT_USER,
    @APP_DEL_PREVIOUS_USER,
    NEW.DEL_PRIORITY,
    NEW.DEL_DURATION,
    NEW.DEL_QUEUE_DURATION,
    NEW.DEL_DELAY_DURATION,
    NEW.DEL_STARTED,
    NEW.DEL_FINISHED,
    NEW.DEL_DELAYED,
    @APP_CREATE_DATE,
    NULL,
    @APP_UPDATE_DATE,
    NEW.APP_OVERDUE_PERCENTAGE,
    NEW.DEL_LAST_INDEX
  );
  END IF;
END
7. Then click on "Go" to save the changes and this screen should appear:
Saved_new_trigger.png
Saved_new_trigger.png (152.43 KiB) Viewed 2349 times
User avatar
By amosbatto
#795949
marcosfpa wrote:Right. If I have multiple workspaces should I do the procedure for each one or is there a way to apply them all at once?
You have to do it for each workspace. You can create a script file named updateTrigger.sql like this:
Code: Select all
use wf_workflow;
DROP TRIGGER IF EXISTS `APP_DELEGATION_INSERT`;
CREATE DEFINER=`wf_59c08d4595a0c`@`localhost` TRIGGER `APP_DELEGATION_INSERT` BEFORE INSERT ON `APP_DELEGATION` FOR EACH ROW BEGIN
  DECLARE DEFAULT_LANG VARCHAR(2);
  DECLARE APP_NUMBER INT;
  DECLARE APP_STATUS VARCHAR(32);
  DECLARE APP_CREATE_DATE DATETIME;
  DECLARE APP_UPDATE_DATE DATETIME;
  DECLARE APP_TITLE VARCHAR(255);
  DECLARE APP_PRO_TITLE VARCHAR(255);
  DECLARE APP_TAS_TITLE VARCHAR(255);
  DECLARE APP_CURRENT_USER VARCHAR(255);
  DECLARE PREVIOUS_USR_UID VARCHAR(32);
  DECLARE APP_DEL_PREVIOUS_USER VARCHAR(255);
  DECLARE APP_THREAD_STATUS VARCHAR(32);
  SET @DEFAULT_LANG = 'en';
  SET @APP_CURRENT_USER = '';
  SELECT APPLICATION.APP_NUMBER into @APP_NUMBER FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_STATUS into @APP_STATUS FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_CREATE_DATE into @APP_CREATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;
  SELECT APPLICATION.APP_UPDATE_DATE into @APP_UPDATE_DATE FROM APPLICATION WHERE APP_UID = NEW.APP_UID LIMIT 1;

  SELECT APPLICATION.APP_TITLE into @APP_TITLE FROM APPLICATION WHERE NEW.APP_UID=APPLICATION.APP_UID LIMIT 1;
  IF ( @APP_TITLE IS NULL ) THEN
    SET @APP_TITLE = '';
  END IF;
  SELECT PROCESS.PRO_TITLE into @APP_PRO_TITLE FROM PROCESS WHERE NEW.PRO_UID=PROCESS.PRO_UID LIMIT 1;
  SELECT TASK.TAS_TITLE into @APP_TAS_TITLE FROM TASK WHERE NEW.TAS_UID=TASK.TAS_UID LIMIT 1;
  SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_CURRENT_USER FROM USERS WHERE USR_UID = NEW.USR_UID LIMIT 1;
  IF ( @APP_CURRENT_USER IS NULL ) THEN
    SET @APP_CURRENT_USER = '';
  END IF;
  IF ( NEW.DEL_PREVIOUS > 0 ) THEN
    SELECT USR_UID INTO @PREVIOUS_USR_UID FROM APP_DELEGATION WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
    SELECT CONCAT(USERS.USR_LASTNAME,  ' ',  USERS.USR_FIRSTNAME) INTO @APP_DEL_PREVIOUS_USER FROM USERS WHERE USR_UID = @PREVIOUS_USR_UID LIMIT 1;
    IF ( @APP_DEL_PREVIOUS_USER IS NULL ) THEN
      SET @APP_DEL_PREVIOUS_USER = '';
    END IF;
  ELSE
    SET @APP_DEL_PREVIOUS_USER = '';
    SET @PREVIOUS_USR_UID = '';
  END IF;
  SELECT APP_THREAD_STATUS INTO @APP_THREAD_STATUS FROM APP_THREAD WHERE APP_UID = NEW.APP_UID AND DEL_INDEX = NEW.DEL_PREVIOUS LIMIT 1;
  IF ( @APP_THREAD_STATUS IS NULL ) THEN
    SET @APP_THREAD_STATUS = 'OPEN';
  END IF;
  SET @TAS_TYPE = (SELECT TAS_TYPE FROM TASK WHERE TAS_UID = NEW.TAS_UID LIMIT 1);
  IF( @TAS_TYPE != 'SUBPROCESS') THEN
  UPDATE APP_CACHE_VIEW SET DEL_LAST_INDEX = 0 WHERE APP_UID = NEW.APP_UID;
    INSERT INTO `APP_CACHE_VIEW`  (
    APP_UID,
    DEL_INDEX,
    APP_NUMBER,
    APP_STATUS,
    USR_UID,
    PREVIOUS_USR_UID,
    TAS_UID,
    PRO_UID,
    DEL_DELEGATE_DATE,
    DEL_INIT_DATE,
    DEL_FINISH_DATE,
    DEL_TASK_DUE_DATE,
    DEL_RISK_DATE,
    DEL_THREAD_STATUS,
    APP_THREAD_STATUS,
    APP_TITLE,
    APP_PRO_TITLE,
    APP_TAS_TITLE,
    APP_CURRENT_USER,
    APP_DEL_PREVIOUS_USER,
    DEL_PRIORITY,
    DEL_DURATION,
    DEL_QUEUE_DURATION,
    DEL_DELAY_DURATION,
    DEL_STARTED,
    DEL_FINISHED,
    DEL_DELAYED,
    APP_CREATE_DATE,
    APP_FINISH_DATE,
    APP_UPDATE_DATE,
    APP_OVERDUE_PERCENTAGE,
    DEL_LAST_INDEX
  )
  VALUES (
    NEW.APP_UID,
    NEW.DEL_INDEX,
    @APP_NUMBER,
    @APP_STATUS,
    NEW.USR_UID,
    @PREVIOUS_USR_UID,
    NEW.TAS_UID,
    NEW.PRO_UID,
    NEW.DEL_DELEGATE_DATE,
    NEW.DEL_INIT_DATE,
    NEW.DEL_FINISH_DATE,
    NEW.DEL_TASK_DUE_DATE,
    NEW.DEL_RISK_DATE,
    NEW.DEL_THREAD_STATUS,
    @APP_THREAD_STATUS,
    @APP_TITLE,
    @APP_PRO_TITLE,
    @APP_TAS_TITLE,
    @APP_CURRENT_USER,
    @APP_DEL_PREVIOUS_USER,
    NEW.DEL_PRIORITY,
    NEW.DEL_DURATION,
    NEW.DEL_QUEUE_DURATION,
    NEW.DEL_DELAY_DURATION,
    NEW.DEL_STARTED,
    NEW.DEL_FINISHED,
    NEW.DEL_DELAYED,
    @APP_CREATE_DATE,
    NULL,
    @APP_UPDATE_DATE,
    NEW.APP_OVERDUE_PERCENTAGE,
    NEW.DEL_LAST_INDEX
  );
  END IF;
END

#repeat the above code for each workspace
Then execute it from the command line with:
Code: Select all
mysql -u root -p < updateTrigger.sql
By john123
#815230
Hi,
I did what amosbatto instructed in the previous replies, modifying the trigger in the mysql, but it doesn't seems to be working, I. still having duplicated messages in the inbox. Is the problem fixed by the developers?
User avatar
By amosbatto
#815260
John123, What version of ProcessMaker do you have? You need to change `wf_59c08d4595a0c`@`localhost` to match your system.

Post the contents of your shared/sites/workflow/db.php file if you can't figure it out.
Task doesnt have any users.

I have created a small process. Users are assigned[…]

NEW MOBILE APP ISSUE

Just trying to setup to use the mobile App with my[…]

It's really a great idea. I have followed the seco[…]

yes i use php thanks for the information