PauseJobAsync(Int32,String,String,String,Nullable<DateTime>,String,String,Int32,Int32,String,Nullable<Boolean>,Nullable<Int32>) Method
- Last UpdatedNov 06, 2025
- 3 minute read
The PauseJobAsync() method stops, suspends, or puts on hold the specified job running on the specified entity.
This overload of the method uses the entity name and site name to specify the entity. It also uses the jobPauseTimeUtc parameter for supplying a specific job pause time.
'Declaration
Public Overloads Shared Sub PauseJobAsync( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entName As String, _
ByVal siteName As String, _
ByVal jobPauseTimeUtc As Nullable(Of Date), _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Integer, _
ByVal pausedJobState As Integer, _
ByVal statusNotes As String, _
ByVal checkPrivileges As Nullable(Of Boolean), _
ByVal jobPos As Nullable(Of Integer) _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entName As String
Dim siteName As String
Dim jobPauseTimeUtc As Nullable(Of Date)
Dim woId As String
Dim operId As String
Dim seqNo As Integer
Dim pausedJobState As Integer
Dim statusNotes As String
Dim checkPrivileges As Nullable(Of Boolean)
Dim jobPos As Nullable(Of Integer)
JobExec.PauseJobAsync(sessionId, userId, entName, siteName, jobPauseTimeUtc, woId, operId, seqNo, pausedJobState, statusNotes, checkPrivileges, jobPos)
public static void PauseJobAsync(
int sessionId,
string userId,
string entName,
string siteName,
Nullable<DateTime> jobPauseTimeUtc,
string woId,
string operId,
int seqNo,
int pausedJobState,
string statusNotes,
Nullable<bool> checkPrivileges,
Nullable<int> jobPos
)
Parameters
- sessionId
- Required. Holds the ID of the session from which the job is being paused.
- userId
- Required. Holds the ID of the user who is pausing the job.
- entName
- Required. Holds the name of the entity on which the job is running.
- siteName
- Optional. Holds the site name of the entity on which the job is running.
- jobPauseTimeUtc
- Optional. Holds the pause time, in UTC, of the job. If not provided, the current time in UTC is used.
- woId
- Required. Holds the work order ID of the job.
- operId
- Required. Holds the operation ID of the job.
- seqNo
- Required. Holds the job sequence number.
- pausedJobState
- Required. Holds the new state of the job. Valid values are 1 (New), 2 (Ready), 4 (Complete), 5 (Suspended), 6 (On hold).
- statusNotes
- Optional. Holds notes associated with the state change. Default is null.
- checkPrivileges
- Optional. Holds a flag that, if set to true, specifies that the user’s privileges should be checked before executing this action. Default is false.
- jobPos
- Optional. Holds the job position. If greater than 1, jobs are running on this entity.
The work order ID, operation ID, and sequence number are all required to identify the job to be paused on the specified entity.
For the method to succeed, the job must be currently running on the specified entity.
If the pausedJobState parameter is invalid, then it is defaulted to 5 (Suspended).
If the call is successful, the Job table is updated as follows for the specified job:
state_cd = paused_job_state
status_notes = status_notes
act_finish_time = current datetime
If the call is successful, the current job data fields in the Job_Exec table are updated as follows for this entity:
Cur_wo_id = Null
Cur_oper_id = Null
Cur_seq_no = 0
Cur_Step_No = Null
Cur_Step_Start = Null
If no value for the jobPauseTimeUtc parameter is supplied, the job_end* times in the Job_History table are updated with the current UTC time. Otherwise, the supplied time is used to update the job_end* times in the Job_History table.