LogOffJob(Int32,String,Int32,Int32,Nullable<Int32>,DBString,DBDateTime,Nullable<Boolean>,String) Method
- Last UpdatedNov 06, 2025
- 3 minute read
The LogOffJob() method logs the active user off a job and, optionally, off the entity on which the job is running.
If an entity is being specified, this overload of the method specifies the entity by its ID.
'Declaration
Public Overloads Shared Sub LogOffJob( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entId As Integer, _
ByVal jobPos As Integer, _
ByVal pausedJobState As Nullable(Of Integer), _
ByVal statusNotes As DBString, _
ByVal logOffTime As DBDateTime, _
ByVal logOffEnt As Nullable(Of Boolean), _
ByRef logOffErrorMsg As String _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entId As Integer
Dim jobPos As Integer
Dim pausedJobState As Nullable(Of Integer)
Dim statusNotes As DBString
Dim logOffTime As DBDateTime
Dim logOffEnt As Nullable(Of Boolean)
Dim logOffErrorMsg As String
Session.LogOffJob(sessionId, userId, entId, jobPos, pausedJobState, statusNotes, logOffTime, logOffEnt, logOffErrorMsg)
public static void LogOffJob(
int sessionId,
string userId,
int entId,
int jobPos,
Nullable<int> pausedJobState,
DBString statusNotes,
DBDateTime logOffTime,
Nullable<bool> logOffEnt,
out string logOffErrorMsg
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- userId
- Required. Holds the ID of the user who is being logged off.
- entId
- Required. Holds the ID of the entity on which the job is running.
- jobPos
- Required. Holds the job position of the job on the entity.
- pausedJobState
- Optional. Holds the state of a paused job.
- statusNotes
- Optional. Holds a string that contains the job status notes.
- logOffTime
- Optional. Holds the actual date/time the logoff took place. Defaults to Now. This is useful when importing logoff data from external timekeeping systems.
- logOffEnt
- Optional. Holds a flag that, if set to true, specifies that the user should also be logged off the entity on which the job is running.
- logOffErrorMsg
- Output. If the logOffEnt parameter is set to true, holds the returned error message if an error occurs during the execution of this method.
This method first retrieves the job that is currently running on the supplied entity based on the supplied entity and job position. If the supplied parameter value for pausedJobState parameter is 4, then the job that is running at this job position is completed. However, if the supplied pausedJobState parameter is not equal to 4, then the job is put on to the corresponding state.
If the labor code or the department code is null for the current entity logon record, then the default labor code or department code assigned to the user is used. If a default *_code is not specified for this user (in the User_Name table), then default values from the entity (labor_exec.def_lab_cd, .def_dept_id) are used. If the entity does not have such default values configured, then a random labor code or department code is used while logging this user on to an entity. If the user has logged on to other entities, then the labor percentage is proportionately divided among all the other entities to end up with 100% by excluding this entity’s labor percentage. Thus, the percentage of labor allocated to other entities/jobs is adjusted to reflect the correct share of percentage that receives it.
The description above is applicable if and only if the supplied entity can capture labor (i.e., ent.can_capture_labor is turned on), and the system attribute to account user’s labor time cannot exceed or fall below 100% If the supplied entity is configured not to capture labor time (ent.can_capture_labor is turned off), then the labor time will not be accounted for the user who is logged onto this entity. If the system attribute “Allow user to account for less than 100% of his time” (attr_id=188) is turned on, then the system does not adjust the labor percentage for a user when it falls below 100% Also, if the system attribute “Allow user to account for more than 100% of his time” (attr_id=189) is turned on, then the system does not adjust the labor percentage for a user when it exceeds 100%.
If the logOffEnt parameter is set to true, the entity logon record (ent_logon) identifying the session, the entity, and the logged-on user is removed; otherwise, the user will be logged off this job, thus keeping the user logged on to other jobs on this entity. Also, any error during the execution of this method is sent back as a warning message.
If the logOffEnt parameter is set to false, then the following must be true for the method to succeed:
- The supplied session ID exists in the Sessn table.
- There is a job currently running on the supplied entity at the supplied job position.