Skip to main content

Hello K2 community,

 

I have some custom code in an Endpoint Assembly SmartObject that I use in my workflow via a SmartObject event.

The SmartObject returns a value if it was successful or not, which I save to a data field.

How can I put some logic in my workflow to force it to error if the web service returned an error?

 

Because right now K2 is content to continue the workflow so long as the call was successful, but if the operation the web service was supposed to perform has an issue, I want the workflow to break.  So I can "retry" it in process management when we fix the issue.

 

Thanks!

Hi. You can throw error in c# in endpoint assembly. This take workflow to error state.
Also you can set response to datafield in workflow and then using Code Event chech this datafiled and throw error by c#.

If you do not handle the error in the webservce's code ie, try and catch block then it should bubble up though to the smartobject and workflow as long as there's no error handling in between them either. Another method, like the earlier post suggested, woud be to add a code event after the event where you put the result in the data dield. Then right click on the event and click view code. In there put in.if datafield = error or something " throw new exception("some error mesage")". This will throw a error in the workflow and you will see it in workpace. As long as you dont have a process wide error handling setup for the whole process it should work.


Reply