currentUserKey()
Last updated 10/09/2024
Example One
The following code sends a notification to the current logged in user for the session.
Send a notification to the current logged in user
function DoLogon(five: Five, context: any, result: FiveError) : FiveError {
five.sendNotification(five.currentUserKey(), 'Welcome back');
return five.success(result);
}
Send a notification to the current logged in user
function DoLogon(five, context, result) {
five.sendNotification(five.currentUserKey(), 'Welcome back' );
return five.success(result);
}
Example Two
The following code returns a key (GUID) associated with the current logged-in user. By setting a global variable called UserKey using the setVariable(), the code can later reference this value to perform actions or retrieve data specific to the current user.
Get the key for the current logged in user and store in a global variable
function SetSearchISBN(five: Five, context: any, result: FiveError) : FiveError {
five.setVariable('ISBN', five.field.ISBN);
five.setVariable('Title', `%${five.field.Title}%`);
five.setVariable('UserKey', five.currentUserKey());
five.refreshTable('Book');
five.refreshTable('iUser');
return five.success(result);
}
Get the key for the current logged in user and store in a global variable
function SetSearchISBN(five, context, result) {
five.setVariable('ISBN', five.field.ISBN);
five.setVariable('Title', `%${five.field.Title}%`);
five.setVariable('UserKey', five.currentUserKey());
five.refreshTable('Book');
five.refreshTable('iUser');
return five.success(result);
}