Unofficial documentation how to do interesting things and work around problems in ProcessMaker

Moderator: amosbatto

Forum rules: Unofficial documentation for features which have not been tested by Quality Assurance or may change in future versions of ProcessMaker
#812759
It is possible to redirect the web browser to a different URL (web address) inside ProcessMaker triggers using the G::header() function. If redirecting to a different step in the current task, it is recommended to use the PMFRedirectToStep() function, because it will save the variables in the current trigger before redirecting the web browser. If using G::header(), then save the variables to the current case with PMFSendVariables() before redirecting the web browser.

If using JavaScript, then the web browser can redirected by assigning the URL to window.location.href.

Here are some of the URLs which aren't documented in the ProcessMaker wiki:
    [*]"../cases/cases_Step?TYPE=<TYPE>&UID=<OBJECT-UID>&POSITION=<STEP-NUMBER>&ACTION=<ACTION>" Opens the specified step for the current task of the current case, as long as the currently logged-in user has the proper privileges to open the case. The UID is the unique ID for the object (DynaForm, Input Document, Output Document, etc.) and the POSITION is the positive integer for the step in the task. The first step in a task has a POSITION of 1, the second step is 2, etc. The object's unique ID can be found by editing a process and opening the list of DynaForms, Input Documents or Output Documents and clicking on their UID button. Alternatively, the UID for an object can be looked up in the wf_<WORKSPACE>.CONTENT.CON_ID field where CON_CATEGORY equals 'DYN_TITLE', 'INP_DOC_TITLE' or 'OUT_DOC_TITLE'. The POSITION can be looked up in the wf_<WORKSPACE>.STEP.STEP_POSITION field. The TYPE and ACTION depend upon the type of step: [list][*]DynaForms: "../cases/cases_Step?TYPE=DYNAFORM&UID=<DYNAFORM-UID>&POSITION=<STEP-NUMBER>&ACTION=EDIT" [*]Input Documents: "../cases/cases_Step?TYPE=INPUT_DOCUMENT&UID=<INPUT-DOC-UID>&POSITION=<STEP-NUMBER>&ACTION=ATTACH" [*]Output Documents: "../cases/cases_Step?TYPE=OUTPUT_DOCUMENT&UID=<OUTPUT-DOC-UID>&POSITION=<STEP-NUMBER>&ACTION=GENERATE" [*]External steps: "../cases/cases_Step?TYPE=EXTERNAL&UID=<EXT-STEP-UID>&POSITION=<STEP-NUMBER>&ACTION=EDIT" [*]Notifications (Email): "../cases/cases_Step?TYPE=MESSAGE&UID=<NOTIFICATION-UID>&POSITION=<STEP-NUMBER>&ACTION=" [*]Assign next user (at end of task): "../cases/cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN"
  • "../cases/cases_ShowDocument?a=<CASE-DOCUMENT-UID>"
    Opens an Input Document file or an attached file (not the step for the Input Document), as long as the currently logged-in user has permissions to open the file. Each file created in or uploaded to a case is assigned a case document unique ID which can be used to access that file. To find a file's UID, query the wf_<WORKSPACE>.APP_DOCUMENT.APP_DOC_ID field or use the inputDocumentList() web service. If needing to access particular version of the Input Document file, concatenate "&v=<VERSION-NUMBER>" to the URL, where the version starts counting from the number 1. The version number can be looked up in the wf_<WORKSPACE>.APP_DOCUMENT.DOC_VERSION field.
    • "../cases/cases_ShowOutputDocument?a=<CASE-DOCUMENT-UID>&ext=<EXTENSION>"
      If the currently logged-in user has permissions, opens a generated Output Document file (not the step for the Output Document). Each generated Output Document is assigned a case document unique ID which can be used to access its files. To find the UID for a generated Output Document, query the wf_<WORKSPACE>.APP_DOCUMENT.APP_DOC_ID field or use the outputDocumentList() web service. The extension for the generated output document can be "pdf", "doc" or "html". If needing to access particular version of the generated Output Document, concatenate "&v=<VERSION-NUMBER>" to the URL, where the version starts counting from the number 1. The version number can be looked up in the wf_<WORKSPACE>.APP_DOCUMENT.DOC_VERSION field.
      • "../cases/cases_Derivate"
        Route (derivate) the current case to the next task in the process. Note: The recommended way to route a case to the next task is use PMFDerivateCase(), the routeCase() web service or the PUT /cases/{app_uid}/route-case endpoint.
        • "../cases/cases_Reassign?APP_UID=<CASE-UID>&DEL_INDEX=<INDEX>"
          Open the screen to reassign the specified case to another user. The currently logged-in user has to have the PM_REASSIGNCASE permission in his/her role and must either be the currently designated user to work on the case or have Process Permissions for read-only access to the case. The APP_UID is the case unique ID and the DEL_INDEX is the delegation index, which is an positive integer counting the tasks in a process, starting from 1. Use the @@APPLICATION and @%INDEX system variables to get the case UID and delegation index for the current case. For other cases, these values can be looked up using the caseList() web service or querying the wf_<WORKSPACE>.APP_DELEGATION.APP_UID and wf_<WORKSPACE>.APP_DELEGATION.DEL_INDEX fields in the database.
          • "../cases/cases_OpenToRevise?APP_UID=<CASE-UID>&DEL_INDEX=<INDEX>&to_revise=true&action=to_revise"
            In version 2.X, open a case as a Process Supervisor to review it and edit its DynaForms and Input Document files. The currently logged-in user must have the PM_SUPERVISOR permission in his/her role and must be assigned as a Supervisor for the process. The APP_UID is the case's unique ID and the DEL_INDEX is the case's delegation index.
            • "../login/login[?u=sys<WORKSPACE>/<LANG>/<SKIN>/<PATH>/<PAGE>]"
              Logout of ProcessMaker and redirect to the login page. If the optional "u" parameter is included, then will redirect to that page after login. Include the full web address after the IP address (and port number).
              For example, to redirect to a new case after login:
              "../login/login?u=sysworkflow/en/classic/cases/cases_New"
              • "Location: <URL>?sid=<SESSION-ID>"
                Enter ProcessMaker with a different session ID and redirect to the specified <URL> in ProcessMaker. Session IDs are created with each new login, so this option allows a different user (or the same user with a different login) to enter ProcessMaker. Session IDs can be obtained with the login() web service or by querying the wf_<WORKSPACE>.LOGIN_LOG.LOG_SID or wf_<WORKSPACE>.SESSION.SES_UID fields in the database. If querying the database for active session IDs, note that the wf_<WORKSPACE>.LOGIN_LOG.LOG_STATUS and wf_<WORKSPACE>.SESSION.SES_STATUS fields are not very accurate, because they are only changed when a user clicks on "Logout". If a session expires, because the user does not have any activity for a certain amount of time (which is 24 minutes by default), then these fields will not be updated.
                For example, to enter with the session ID "9501648404de51de1818eb7059342855" and redirect to a new case:
                "../cases/cases_New?sid=9501648404de51de1818eb7059342855"[/list]
                Calculate hours of day/week

                Thank you Amos, The four other variables are for[…]

                timing control

                I suggest that you file a bug report about it at[…]

                Hello Amos, Would this solution work also for PM […]

                Hi amosbatto! When I send a request from ajax to[…]