Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Extension JAR job status not updated currently

kunal_saxena
Regular Contributor
Regular Contributor

Hi,

I am working on a custom JAR file. The JAR file will be executed via a job of type = "Invoke Extension JAR Job (ExternalJarJob)". The method being called from the job is returning the status of the execution in the following manner:

JSONObject jsonObject = new JSONObject();

jsonObject.put("message", message);

jsonObject.put("description", description);

return jsonObject.toString();

If the execution is successful, message="Success", else message="Failure". However, even when message is set to "Failure", the job status in Saviynt is Success. How do we configure the JAR such that when execution is unsuccessful, job status should be "Failure"?

Thanks,

Kunal

6 REPLIES 6

rushikeshvartak
All-Star
All-Star

You can't control job status from Jar. Jar job call respective class 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi @rushikeshvartak , Thanks for replying.

Can you please let me know what is the usage of returning the following from the JAR:

JSONObject jsonObject = new JSONObject();

jsonObject.put("message"message);

jsonObject.put("description"description);

return jsonObject.toString();

As per documentation message should reflect on job status page 

https://docs.saviyntcloud.com/bundle/JAR-v2022x/page/Content/Understanding-the-JAR-Package-Framework... 

The 'message' attribute indicates 'Success or Failure' response for the operation. The 'data' indicates the values to be returned for example account values.


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

kunal_saxena
Regular Contributor
Regular Contributor

I have observed that you can mark the status as "Failure" for a ExternalJarJob by throwing an exception from your custom JAR, that you are invoking via this job.

Therefore, you can create a custom Exception class as part of your JAR. Handle the scenarios in your JAR where you want the job to fail and throw your custom exception. This would mark the job status as Failure.  

Thanks,

Kunal

can you share sample code


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

kunal_saxena
Regular Contributor
Regular Contributor

Hi @rushikeshvartak , 

Please find below the sample code:

Create a Custom Exception class:

package com.myjar.exceptions;

public class CustomException extends Exception {

	private static final long serialVersionUID = 1L;
	
	public CustomException(String errorMessage) {
		super(errorMessage);
	}

}

 Then, in your code, wherever you want to handle a failure scenario, throw your custom exception:

throw new CustomException("handling a failure scenario");

The method you call from the ExternalJarJob should eventually throw your custom exception. This would mark the job status as Failure.