The Session object is a run-time object made available by the workflow engine. The Session object makes it possible to access workflow information and team solution data at run time.
All Session object properties can be set using the Session.Item.Property syntax.
The Session object provides the following properties and methods:
Properties | Description |
Application | Provides team solution properties. |
AppConnection | Returns a Microsoft ActiveX® Data Objects (ADO) connection to the team solution database. |
IsOffline | Returns True if the team solution is running on an offline client. |
Item | Returns the current properties of an item. |
OriginalItem | Returns the original values of the properties of the item. |
RowPermissions | Returns the list of roles and permissions for the current item. |
User | Returns the Microsoft Windows NT® SAM Account Name of the current user. |
UserRoles | Returns all the roles of which a specified user is a member. |
Methods | Description |
IsMember() | Checks whether the current user is member of a specific role. |
UserList | Returns user information from the user directory. |
Access: Read only
Data type: ADODB.Recordset
Default: Team solution registration information
Range: N/A
Returns a single row recordset with all the properties of the current team solution, registered in the modSystem database. For example, the WebServer and Folder columns provide the URL to the Web folder that contains the HTML pages for the team solution. The schema of the recordset matches the schema of the modApplications table in the modSystem database.
Example
Dim App, WebUrl Set App = Session.Application WebUrl = App("WebServer") & "/" & App("Folder")
Access: Read only
Data type: ADODB.Connection
Default: Connection to the team solution database
Range: N/A
Provides an ADO connection to the team solution database. The connection is created the first time the property is used in the script code. For trigger-generated events, the connection is bound to the same transaction in which the trigger is being executed.
IsMember( Role As String )
Data type: Boolean
Parameter | In/Out | Description |
Role | In | Name of a database role. |
Checks whether the current Windows NT user, as identified by the user's SAM Account Name, is a member of the specified database role. Returns True if the user is a role member; otherwise, False. This method uses the information that relates users and roles stored in the modUserRoles table.
Access: Read only
Data type: Boolean
Default: N/A
Range: True, False
Returns True if the workflow action has been invoked by changes made to an offline database. Returns False if the workflow action is located on a server that is online. This property may be used to perform conditional code in the workflow actions. For example, an action may send e-mail only if it is performed on an online server.
Access: Read/Write
Data type: ADODB.Recordset
Default: Item recordset
Range: N/A
Returns a one-row recordset with all the current values of the item that has triggered the workflow action. The values correspond to the values in the inserted table inside the SQL trigger. All values in the Item recordset are updateable. After changes have been made to the recordset, the Session.Item.UpdateBatch method must be called to commit the updates to the database.
For updates made inside a workflow action to the Item columns, Microsoft Access Workflow Designer for Microsoft SQL Server™ prevents the workflow action from being called recursively. This means if the workflow engine is invoked internally from a workflow script to perform the same action in the same transaction and on the same item, the engine skips workflow enforcement. This makes it possible for the change to happen as an internal change. All other actions performed from workflow script are enforced.
Access: Read only
Data type: ADODB.Recordset
Default: Original Item recordset
Range: N/A
Returns a one-row recordset with all the original values of the item that has triggered the workflow action. The values correspond to the values in the deleted table inside the SQL trigger. The original values show the changes that are being made to various properties of the item. They may be used to filter acceptable changes to non-workflow columns, to verify row-level rules for the current item, and so on.
There is a performance cost involved in providing the original values in the Session object. Access Workflow Designer provides a way to control whether or not those values for each table should be provided at run time. It is recommended you enable the OriginalItem recordset only if the workflow action script requires those values.
Access: Read only
Data type: ADODB.Recordset
Default: Row permissions recordset
Range: N/A
Returns a recordset with all the roles that have access to the current row (Item) and the permissions granted to each role. It may be used to find out the permissions of the current user on the Issue properties and enforce those permissions in the action script code.
Access: Read only
Data type: String
Default: SAM Account Name
Range: N/A
Returns the SAM Account Name (for example, "domain\user") of the current user. The user name may be stored in the CreateBy or ModifiedBy field of the item. In addition, it can be used to filter the modUserList table to locate user-related information such as the manager or direct reports. (For more information, see the UserList method.)
UserList( Filter As String )
Data type: ADODB.Recordset
Parameter | In/Out | Description |
Filter | In | (Optional) ADO filter applied to the UserList recordset. |
Returns a recordset with the same schema as the modUserList table in the modSystem database. If a filter expression is provided, it is applied to the output. For example, this property can be used to select all the direct reports of the current user or to select its manager.
Access: Read only
Data type: ADODB.Recordset
Default: Current user roles recordset
Range: N/A
Returns a recordset with all the database roles of which the current user is a member. Because security is based on roles, this information can be used to determine the level of security granted to the current user.