StartJob(Int32,String,Int32,String,String,Int32,String,Nullable<Int32>,Nullable<Int32>,Nullable<Int32>,Nullable<DateTime>) Method
- Last UpdatedNov 06, 2025
- 3 minute read
The StartJob() method starts the specified job on the specified entity.
This overload of the method uses the entity ID to specify the entity. It also uses the eventTime parameter for supplying a specific job start time.
'Declaration
Public Overloads Shared Sub StartJob( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entId As Integer, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Integer, _
ByVal statusNotes As String, _
ByVal checkPrivileges As Nullable(Of Integer), _
ByVal checkCerts As Nullable(Of Integer), _
ByVal jobPos As Nullable(Of Integer), _
ByVal eventTime As Nullable(Of Date) _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entId As Integer
Dim woId As String
Dim operId As String
Dim seqNo As Integer
Dim statusNotes As String
Dim checkPrivileges As Nullable(Of Integer)
Dim checkCerts As Nullable(Of Integer)
Dim jobPos As Nullable(Of Integer)
Dim eventTime As Nullable(Of Date)
JobExec.StartJob(sessionId, userId, entId, woId, operId, seqNo, statusNotes, checkPrivileges, checkCerts, jobPos, eventTime)
public static void StartJob(
int sessionId,
string userId,
int entId,
string woId,
string operId,
int seqNo,
string statusNotes,
Nullable<int> checkPrivileges,
Nullable<int> checkCerts,
Nullable<int> jobPos,
Nullable<DateTime> eventTime
)
Parameters
- sessionId
- Required. Holds the ID of the session from which the job is being started.
- userId
- Required. Holds the ID of the user who is starting the job.
- entId
- Required. Holds the ID of the entity on which the job is to be run.
- 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.
- statusNotes
- Optional. Holds notes about 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 starting the job. Default is false.
- checkCerts
- Optional. Holds a flag that, if set to true, specifies that the user’s certifications should be checked before starting the job (requires the Certification module). Default is false.
- jobPos
- Optional. Holds the job position. If greater than 1, jobs are running on this entity.
- eventTime
- Optional. Holds the start time, in the entity's local time, of the job. If not provided, the current local time is used.
Note: Starting a job more than 15 days in the past will exclude the creation of hourly buckets more than 15 days old in the job_hourly_history table.
This method starts a job or a batch of jobs. It retrieves the status of the current job and its concurrent link number for the supplied work order ID, operation ID, and sequence number.
If the concurrent link is 0, that indicates that the current job to start is not linked to a batch. The current job will be started on the supplied job_pos. If the supplied job_pos is null, then the system retrieves the job_pos for the supplied entity ID and starts the job.
If the current job is linked to a batch, then all the linked jobs in a batch are started. To start all the linked jobs, the available job positions for the supplied entity are retrieved. If the job position is available, then the job is started at the available job position. For the rest of the linked jobs, the system iterates through each job in the batch and checks that the job is not in a Running, Completed or Cancelled state. The system then retrieves the available job position and starts the job on that position.
A new record will be created in the Job_History table with the supplied job information. The job_start* times will use the current time if no value for the eventTime parameter is supplied. Otherwise, the supplied start times will be used. A new record in the Job_Hour_History table will be created for the current instance.
For the method to succeed, the following must be true:
- The job can be started on the supplied entity (i.e., the retrieved job_pos is not -1).
- The job is not in the Running, Completed or Cancelled state.
- The system is able to get a job position for each job in the batch.