can I use Try...Catch statement in a Business rule so that Try statement updates certain field in alm_hardware and if there is an error it catches the error using Catch statement ?

EKTA2
Tera Expert

can I use Try...Catch statement in a Business rule so that Try statement updates certain field in alm_hardware and if there is an error it catches the error using Catch statement ?

 

 

My requirement is : I need to update certain fields in alm_hardware via automation basis what is selected in the Catalog Item and if there is any error during automation, I need to open a manual task for a Team. So i am thinking to use Try and Catch. Please let me know if I should try this or some other approach?

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

the try-catch block is universal, and you can use wherever you want. 

But what do you mean with "error"? In case you mean any kind of code error, then yes, you can use it. In case you mean any kind of business error (e.g. the partner systems responds with a status code of 400) then you have to handle this error state differently.

Maik

Thanks, Maik. I am trying to deal with the scenario let's say my code failed to update one field ( probably some scripts stopped it from updating that field) and other fields go updated, I assume I will still get an error which would be caught using catch(e) ? Yes?

 

Do you mean to say had I been working with Integration and would receive error 400 , Catch(e) wont be able to catch that error?