SetReason(Int32,Int32,String,Int32,DBString) Method
- Last UpdatedNov 06, 2025
- 2 minute read
The SetReason() method sets the current reason code for the specified entity.
This overload of the method uses an entity ID to specify the entity.
public static void SetReason(
int sessionId,
int entId,
string userId,
int newReasCd,
DBString comments
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- entId
- Required. Holds the ID of the entity whose current reason code is being set.
- userId
- Required. Holds the user ID of the user who is setting the new reason on this entity.
- newReasCd
- Required. Holds the code for the new current reason.
- comments
- Optional. Holds additional information for the new reason.
This method first reads the Util_Exec record for the specified entity to determine the reason required (reas_reqd), current state code (cur_state_cd), and the current utilization event (cur_log_id) flags. Then it reads the default labor code (util_reas.def_lab_cd) from the Util_Reas table to determine whether setting this new reason should trigger a labor transaction or not. If a non-null labor code is configured for the supplied reason code, then this labor code is applied to all users who are actively logged on to this entity, thereby closing their existing labor record and re-opening a new labor record with this default labor code.