GetStatus is used to retrieve the status of a Batch Job. This service takes as input the name of the BatchJob you wish retrieve the status of. This is not case sensitive. For GetStatus to return anything other than whether a Batch Job is running or not you must use it in conjucntion with UpdateStatus.
Batch Jobs are processes that can be scheduled to run. They run outside of user interaction and are not initiated by button clicks or page loads like most processes.
This service can be used to verify if a BatchJob is running.
GetStatus Use Examples
GetStatus Basic Uses
Here we have four services, two of which are GetStatus services. The first service starts the Batch Job then if we let it run for a little bit we can get the status and see how many times it has run through the loop that exists in the process.
Here is the output from the GetStatus call
As you can see, at the time GetStatus was run, the Batch Job was still running. The GetStatus service returns the following attributes:
WindowsProcessId: This is the assigned windows process id of the batch job. This can be used to find the batch job in the Windows Task Manager and monitor is resource usage and if necessary, end the task.
LastProcessed: The last record processed. In this example, we are looping through items. The last item processed was “M001”, which is set by the UpdateStatus service.
ProcessedCount: The current process count is 15 so the batch job has run through the loop 15 times.
EstimateCount: The estimate count is set to 30. This value was set by the UpdateStatus service. Depending on the type of batch job that is running, the estimate can be determined in different ways.
UploadCount: The upload count is set to 30. This value was set by the UpdateStatus service. Again, the meaning of the upload count depends on the type of batch job.
ErrorCount: Error Count is set to 0 which is set by the UpdateStatus service. The developer who creates the batch job will determine what is considered an error an increments the count.
Message: The message entered is “Inside” and is accompanied by a date/time stamp. This stamp indicates the time the message was written (message is written by UpdateStatus service).
After the batch job has ended, GetStatus is called again. Here is the returned output from the GetStatus service.
As you can see, only two things have changed. In this example, we only used UpdateStatus to increment the ProcessedCount, so you can see this value has changed. The GetStatus service also knows the Batch Job has ended as running is now returned False. It has also recorded that it ran through the loop 47 times before it finally ended.
GetStatus must work in conjunction with UpdateStatus in order to be effective for anything other than knowing that the Batch Job is running or not.
The only time GetStatus will throw an error is if you put an invalid name into the Name variable. The error will look like this
If you enter in a valid Batch Job name but it is not the Batch Job you are intending to look at you will just get the last status of that Batch Job but no error will be thrown.