SetJobQueue(Int32,String,String,Int32,Nullable<Int32>,Nullable<Int32>,Nullable<DateTime>,Nullable<Int32>,Nullable<Int32>,String,Int32,DateTime,Boolean) Method
- Last UpdatedNov 06, 2025
- 3 minute read
The SetJobQueue() method sets the queue sequence for all the jobs.
This overload of the method uses the entity ID to specify the entity.
'Declaration
Public Overloads Shared Sub SetJobQueue( _
ByVal sessionId As Integer, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Integer, _
ByVal stateCd As Nullable(Of Integer), _
ByVal jobPriority As Nullable(Of Integer), _
ByVal reqFinishTime As Nullable(Of Date), _
ByVal targetSchedEntId As Nullable(Of Integer), _
ByVal concurrentLink As Nullable(Of Integer), _
ByVal statusNotes As String, _
ByRef runEntId As Integer, _
ByRef editTime As Date, _
ByRef refreshAll As Boolean _
)
'Usage
Dim sessionId As Integer
Dim woId As String
Dim operId As String
Dim seqNo As Integer
Dim stateCd As Nullable(Of Integer)
Dim jobPriority As Nullable(Of Integer)
Dim reqFinishTime As Nullable(Of Date)
Dim targetSchedEntId As Nullable(Of Integer)
Dim concurrentLink As Nullable(Of Integer)
Dim statusNotes As String
Dim runEntId As Integer
Dim editTime As Date
Dim refreshAll As Boolean
JobExec.SetJobQueue(sessionId, woId, operId, seqNo, stateCd, jobPriority, reqFinishTime, targetSchedEntId, concurrentLink, statusNotes, runEntId, editTime, refreshAll)
public static void SetJobQueue(
int sessionId,
string woId,
string operId,
int seqNo,
Nullable<int> stateCd,
Nullable<int> jobPriority,
Nullable<DateTime> reqFinishTime,
Nullable<int> targetSchedEntId,
Nullable<int> concurrentLink,
string statusNotes,
out int runEntId,
out DateTime editTime,
out bool refreshAll
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- woId
- Required. Holds the ID of the work order.
- operId
- Required. Holds the ID of the operation of the work order.
- seqNo
- Required. Holds the job sequence number.
- stateCd
- Optional. Holds the new state code for a job.
- jobPriority
- Optional. Holds the new priority for a job.
- reqFinishTime
- Optional. Holds the new required finish time for a job.
- targetSchedEntId
- Optional. Holds the ID of the new entity to which the job should be scheduled.
- concurrentLink
- Optional. Holds the batch number for this job.
- statusNotes
- Optional. Holds a new status note for this job.
- runEntId
- Output. Holds either the returned ID of the entity where this job is currently running or ran in the past, or the ID of the target scheduled entity.
- editTime
- Output. Holds the date/time when the record was created or last updated. Returns null if more than one job record is modified on this method call; otherwise, the edit_time from the affected job is returned.
- refreshAll
- Output. Holds a flag that indicates whether the client should re-retrieve the entire job queue (if set to true) or just this job record (if set to false). Returns true if more than one job record is affected on this method call; otherwise false.
The state of the current job will not be changed if the supplied state code is Running (3), Completed (4), or Suspended (5). Otherwise, the job is changed to the supplied state. The job priority, required finish time, target scheduled entity, concurrent link number, and status notes are updated with the supplied values. Additionally, if the supplied state code for this job is Cancelled (7), then the actual finish time for this job is updated with the current date and time.
If the supplied state code is Suspended (5), then the supplied job and all the jobs linked to this batch (if any) are suspended.
For the method to succeed, the following must be true:
- The supplied job does exists in the database.
- If the supplied job is on hold (6), the user (the user on this session context) has a privilege “May change hold status”, PrivId:180 to change the status of the job.
- If the supplied job is linked to a batch, and one of the job(s) is on hold and one of the job(s) in the batch is queued to this target scheduled entity or any of its descendants, the user (the user on this session context) has a privilege “May change hold status”, PrivId:180 to change the status of the job.
- If an attempt is made to detach the job (concurrent_link = 0) from a batch, no job(s) are currently running on the batch.
- If an attempt is made to link this job to an existing batch, no jobs are currently running on the batch.