How to delete cases in PM? - processmaker-api

I am trying to delete cases in PM but I am not able to using the API
http://wiki.processmaker.com/3.1/REST_API_Cases#Delete_Case:DELETE.2Fcases.2F.7Bapp_uid.7D
I have tried this API but it gives me an error like:
[GuzzleHttp\Exception\ClientException]
Client error: `DELETE http://processmaker.app:32768/api/1.0/workflow/cases/50492041658e1dfca544ad3002222462` resulted in a `400 Bad Request` response:
{"error":{"code":400,"message":"Bad Request: You can't delete the case because it's not in Draft status and was already (truncated...)
Yes, I even tried cancelling the case but still the same error

The error you are receiving is because you cannot delete a case once it has left the status of DRAFT. That means, once a case is submitted to the next task, it is considered in the status of TODO.
So, once a case has transitioned to the status of TODO, you may only Cancel a case, not delete it.
You can find more information relating to that here: http://wiki.processmaker.com/3.1/user_guide#Cancel
Don't forget to make sure that the user you are making the rest api call as has the right permissions to be able to cancel/delete the case as well.
To cancel a case through the rest api, take a look at this link: http://wiki.processmaker.com/3.1/REST_API_Cases#Cancel_Case:PUT.2Fcases.2F.7Bapp_uid.7D.2Fcancel
I hope that helps!

Related

Amazon MTurk: can't delete HIT in state 'Reviewable'

I am using the script offered here to delete deployed HITs from the Amazon Mechanical Turk platform. However, I am getting the following exception by the mturk client:
An error occurred (RequestError) when calling the DeleteHIT operation: This HIT is currently in the state 'Reviewable'. This operation can be called with a status of: Reviewing, Reviewable (1574723552282 s)
To me, the error msg itself seems to be wrong. Does anybody have an explanation for this behaviour?
Try somethng like this maybe, I found this somewhere and it can solve your problem,
# if hit is reviewable and has assignments, approve assignments
if status == 'Reviewable':
assignments = mturk.list_assignments_for_hit(HITId=hit['HITId'], AssignmentStatuses=['Submitted'])
if assignments['NumResults'] > 0:
for assign in assignments['Assignments']:
mturk.approve_assignment(AssignmentId=assign['AssignmentId'])
try:
mturk.delete_hit(HITId=hit['HITId'])
except:
print('Not deleted')

Facebook Login Error Code 1 Sub code 1357045

I have implemented a login with facebook method in my website. Originally it works fine, but suddenly this past few days it won't work anymore, even tough I don't change any source code or settings. After some tracing, I found the problem is when I call FB.api /me? it returns this error:
Error Code 1
Error Sub Code 1357045
Message Unknown Error (empty response)
Type Http
Status 0
Does anyone can help me, please ??
FIXED:
Problem solve at this thread Facebook Login JAvascript SDK, Content Securty Policy
Also this error can be because of some extension added to your browsers such as addBlock, Ghostery etc. In my case it was Ghostery.

Getting "Error: Assertion Failed: calling set on destroyed object" when trying to rollback a deletion

I am looking into how to show proper deletion error message in ember when there is an error coming back from the server. I looked at this topic and followed its suggestion:
Ember Data delete fails, how to rollback
My code is just like it, I return a 400 and my catch fires and logs, but nothing happens, when I pause it in the debugger though and try to rollback, I get Error: Assertion Failed: calling set on destroyed object
So A) I cannot rollback B) the error is eaten normally.
Here is my code
visitor.destroyRecord().then(function() {
console.log('SUCCESS');
}).catch(function(response) {
console.log('failed to remove', response);
visitor.rollback();
});
In case it's relevant, my model does have multiple relationships. What am I doing wrong? Ember-data version is 1.0.0.8 beta (previous one from the release a few days ago).
Thanks in advance.
EDIT
I discovered now that the record actually is restored currently inside the cache according to ember inspector, but the object will not reappear in the rendering of the visitors. I need some way to force it to reload into the template...
After destroyRecord, the record is gone and the deletion cannot be rolled back. The catch clause will just catch a server error. If you want the record back, and think it's still on the server, you'll have to reload it.
See the following comment on deleteRecord from the Ember Data source:
Marks the record as deleted but does not save it. You must call
`save` afterwards if you want to persist it. You might use this
method if you want to allow the user to still `rollback()` a
delete after it was made.
This implies that a rollback after save is not possible. There is also no sign anywhere I can see in the Ember Data code for somehow reverting a record deletion when the DELETE request fails.
In theory you might be able to muck with the isDeleted flag, or override various internal hooks, but I'd recommend against that unless you really know how things work.
Try reloading the model after the rollback. It will reload from the server but it was the only way around this that I could find.
visitor.destroyRecord().then(function() {
console.log('SUCCESS');
}).catch(function(response) {
console.log('failed to remove', response);
visitor.rollback();
visitor.reload().then(function(vis)
{
console.log('visitor.reload :: ' + JSON.stringify(vis));
});
});
Hope that helps.

Sharing through Facebook SDK I am getting the following error in iphone app?Can you suggest me what mistake might me I made?

While I am trying to share something through facebook SDK I am getting error like
"Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0xd1700a0 {error={ code = 12; message = "(#12) username is deprecated for versions v2.0 and higher"; type = OAuthException; }}".
Can any one help me which kind of error will be? Thanks in advance
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0
there is a clear explanation of the facebook error code in the link given above
according to that your error means: login status or access token has expired, been revoked, or is otherwise invalid - Handle expired access tokens (unless subcode is present)

Facebook Credits - getOrders call for refunds/chargebacks

I am using the Get Orders call for our app as specified in:
developers.facebook.com/docs/creditsapi/
It all works fine when I set the status=settled, but if I set the status to reserved or refunded, then I get no results. This is even over a period where I know we had refunds/chargebacks.
This works:
https://graph.facebook.com/APP_ID/payments?status=settled&since=1320537600&until=1320624000&access_token=ACCESS_TOKEN
But this never returns anything:
https://graph.facebook.com/APP_ID/payments?status=refunded&since=1320537600&until=1320624000&access_token=ACCESS_TOKEN
Has anyone else had any luck with this API call? Are my expectations wrong? (I am expecting to get a result if a refund occurred within the specified time frame).
If anyone else is experiencing this, a bug has been opened and assigned with high priority here: http://developers.facebook.com/bugs/159012307531417