Set Session Identifier

Sets an identifier for the user's current session.

Options 

  • Specify the session identifier as text or a calculation whose result is text.

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect Yes
FileMaker Server Yes
FileMaker Cloud Yes
FileMaker Data API Yes
Custom Web Publishing Yes

Originated in version 

19.4.1

Description 

By default, the session identifier is the same value returned by the Get(UserName) function. You can use this script step to change the session identifier so that it provides additional information to administrators. For each FileMaker client connected to a given host, there is only one value for the session identifier. This value remains in effect until Set Session Identifier is performed again in any custom app on the same host opened by the same client in the same session, or until the session ends.

The session identifier is available to administrators in the following ways:

  • FileMaker Server Admin Console displays the session identifier on the Databases page.

  • The Access log for FileMaker Server includes an entry that shows when this script step changed the session identifier from one value to another.

  • The FileMaker Admin API returns the session identifier as the userName value using the List Clients call on FileMaker Server and FileMaker Cloud.

See FileMaker Server Help and FileMaker Admin API Guide.

Best practices

  • If each user signs in with a unique account, you can identify them by their account name. In that case, there may be no reason to use Set Session Identifier.

  • If multiple users sign in with the same account or use the Guest account, their account names don't identify them. If you have an alternative method to identify these users, you can use Set Session Identifier to make those users' identifiers available to administrators in the ways described above.

  • Perform Set Session Identifier in a start-up script (a script activated by the OnFirstWindowOpen script trigger) so that the session identifier is set when the session begins.

  • If you have more than one custom app on a host, use the same method to determine the session identifier in each app's start-up script. Otherwise, the identifier may change when the same user opens different apps.

  • If your app includes a script that allows users to sign out and sign in again as a different user (for example, using the Re-Login script step), your script may also need to perform Set Session Identifier to update the session identifier.

Notes 

  • This script step doesn't change the value returned by the Get(UserName) function.

  • If the current app is a local file, this script step does nothing.

Example 1 

For a student survey, prompts users to enter their student ID, uses a custom function (IsStudentIDValid) to check that the student ID is valid, then sets the session identifier to the student ID.

Copy
Set Field [ Survey::StudentID ; "" ]
Show Custom Dialog [ Message: "Enter your student ID number." ; Survey::StudentID ]
If [ IsStudentIDValid ( Survey::StudentID ) ]
    Set Session Identifier [ Survey::StudentID ] 
Else
    Show Custom Dialog [ "A valid student ID is required." ]
    Exit Script [ Result: "A valid student ID was not provided." ] 
End If