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

Moderator: amosbatto

Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
#786282
Dear Team,

Here i am using processmaker rest api to delete input file.

I am developing the below code to remove input file:
Code: Select all
var app_doc_uid=$scope.php_script_response2[i].app_doc_uid;
var del_index=1;
var app_uid=$scope.caseId;

var requestYmc = $http({
            method: 'POST',
            url: $scope.serverUrl + $scope.workspace + '/oauth2/token',
            data: $scope.credentials
        });
        requestYmc.success(function (html) {
            $scope.AccessToken = html.access_token;
            var requestZmc = $http({
                method: 'DELETE',
                url: $scope.serverUrl + 'api/1.0/'+$scope.workspace+'/cases/'+app_uid+'/'+del_index+'/input-document/'+app_doc_uid,
                headers: { 'Authorization': 'Bearer ' + html.access_token }
            });
            requestZmc.success(function (html) {
            
            });
        });

Here i am getting the following error :
{"error":{"code":400,"message":"Bad Request: **ID_CASES_INPUT_DOCUMENT_DOES_NOT_EXIST**"}}

Please help me

Thanks and Regards
Sowjanya
#825462
sowjanya wrote: Tue Aug 09, 2016 7:39 am Dear Team,

Here i am using processmaker rest api to delete input file.

I am developing the below code to remove input file:

var app_doc_uid=$scope.php_script_response2.app_doc_uid;
var del_index=1;
var app_uid=$scope.caseId;
usps tracking
var requestYmc = $http({
method: 'POST',
url: $scope.serverUrl + $scope.workspace + '/oauth2/token',
data: $scope.credentials
});
requestYmc.success(function (html) {
$scope.AccessToken = html.access_token;
var requestZmc = $http({
method: 'DELETE',
url: $scope.serverUrl + 'api/1.0/'+$scope.workspace+'/cases/'+app_uid+'/'+del_index+'/input-document/'+app_doc_uid,
headers: { 'Authorization': 'Bearer ' + html.access_token }
});
requestZmc.success(function (html) {

});
});


Here i am getting the following error :
{"error":{"code":400,"message":"Bad Request: **ID_CASES_INPUT_DOCUMENT_DOES_NOT_EXIST**"}}

Please help me

Thanks and Regards
Sowjanya


I also need help with the same. Help is appreciated.

Regards,
Shane
Last edited by ShaneP on Sun Jul 21, 2019 4:40 pm, edited 1 time in total.
#825467
Shane,
I found a bug in this REST endpoint. I registered a bug report about it:
https://processmaker.atlassian.net/browse/TRI-3940

To fix it, change the code at the top of the file workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php from:
Code: Select all
use StepSupervisorPeer;
use Users;
use WsBase;

class InputDocument
To:
Code: Select all
use StepSupervisorPeer;
use Users;
use WsBase;
use GroupUserPeer;

class InputDocument
Now it should be possible to delete the Input Document. Also remember that you need to give the logged-in user Process Permissions to delete the Input Document.

Are you displaying this Input Document in a File field in a Dynaform? If so, the APP_DOCUMENT.APP_DOC_FIELDNAME field needs to be changed so it is no longer contains the "name" of the File field which displays the Input Document.

If you ask for it, I can add an endpoint to the extraRest plugin to solve this problem.

@{ var result = ""; if (IsPost) […]

Hi, Could you explain to me what is the differenc[…]

Routing Logic

Thanks Amos, will do it how u recommended.

Did you set up your ProcessMaker server to periodi[…]