How to call a function using try and catch block in script include?

Sujatha V M
Kilo Patron
Kilo Patron

Hi Team, 

I'm getting the status code value from a "try" block as below and trying to call a function sendEmail(). 

It fails if called using "this". 

How to call the function to trigger the email notification?

Sujatha8_0-1695888028820.png

The same works if the code is added directly on the "If" condition.

 

 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.
2 REPLIES 2

AnveshKumar M
Tera Sage
Tera Sage

Hi @Sujatha V M 

I tried this code in my PDI, it is working fine. 

 

Did you find any error log in system logs? And try adding gs.info(ex.message); in your catch block to see if there is any error caught.

Thanks,
Anvesh

Sujatha V M
Kilo Patron
Kilo Patron

Thanks for the response. I'm getting the status error code using this "status = response.getStatusCode();

Why is that I'm unable to call the function using this?

What is the other way to call the function sendEmail() within the try block?

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.