Creating custom incident that would block the process execution

Hi All,

How to create a custom incident that would stop and roll back the execution in the similar way “Failed job incident” does. I tried with throwing an exception

throw new java.lang.Exception(“Exception Message”);

But this will block the execution but creates a failed job incident that cannot be resolved with resolve API. Also the message is not graceful.
Basically I would like to create an incident and stop the execution upon API failure.

Regards,
Prasad

Do you have problem with using the exiting functionality?
At the moment if there is a failure it will already rollback to the last wait state and create an incident.
Is there something additional you want?

At present http-connector will not create incident for failed API responses. ie all status codes other than 200. So if the response status code is not 200 , I would like to create an incident (also block the execution) that can be solved later with resolve API.

Are you at a point where you can stop using HTTP connectors and use another way of making rest calls? External Tasks or Java Classes, this would make things a lot easier for you.

Even though its too late…I would prefer to use a Service task with Java Delegate taking the same parameters as to that of an http-connector. This would make the replacement easy for me. I know http-connectors are not production ready. But still in that case how do I stop the execution by creating an incident.

If you used a java class to make the call and called that class from a service task all you would need to do is to mark the task asynchronous before then any error that is thrown by the code will be caught by the engine and the engine will automatically rollback to be for the task and create an incident.