Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Hello, whenever i try to use the REST API to generate an output document, i get the following error.

{"error":{"code":400,"message":"Bad Request: The user with \"00000000000000000000000000000001\" not have permissions to perform this action."}}

This REST function only seems to work for the user user account in which the the output document was originally generated. Is this the default behavior or is there some way to allow the Administrator or Supervisor to generate an output document through the REST API. Thanks.

Im using Processmaker 3.2 Community.
If you want to allow Process Supervisors to generate Output Documents, edit the file workflow/engine/src/ProcessMaker/Services/Api/Cases/OutputDocument.php and change the doPostOutputDocument() function so it has the following code:
Code: Select all
     * @url POST /:app_uid/:del_index/output-document/:out_doc_uid
     * @param string $app_uid     {@min 32}{@max 32}
     * @param int    $del_index   {@min 1}
     * @param string $out_doc_uid {@min 32}{@max 32}
    public function doPostOutputDocument($app_uid, $del_index, $out_doc_uid)
        try {
            $userUid = $this->getUserId();

            $case = new \ProcessMaker\BusinessModel\Cases();
            $outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
            //allow user to create output document if a process supervisor or is assigned to case:
            $aCaseInfo = $case->getApplicationRecordByPk($app_uid, [], false);
            $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
            if ($supervisor->isUserProcessSupervisor($aCaseInfo['PRO_UID'], $userUid) === false) {
                $outputDocument->throwExceptionIfCaseNotIsInInbox($app_uid, $del_index, $userUid);
            $outputDocument->throwExceptionIfOuputDocumentNotExistsInSteps($app_uid, $del_index, $out_doc_uid);
            $response = $outputDocument->addCasesOutputDocument($app_uid, $out_doc_uid, $userUid);

            return $response;
        } catch (\Exception $e) {
            throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());

Hi, In order to delete a case you can follow the[…]

Hi. Have you tried to use JavaScript on your Dyn[…]

Hi Please, could you send information about the c[…]

Dashboard issue

Can you show me what you were trying to do in orde[…]