Get User Information of Logged-on User
- Last UpdatedJun 25, 2024
- 1 minute read
You can get user information of the logged-on user using SFU.getVirtualActorId() and SFU.getUserLookupExtendedInformation() APIs.
Here we will use these APIs to get user information of the logged-on Active Directory user.
-
Create a form with seven Text controls on the form.
-
Modify the properties of the Form as follows:
-
In the Scripts tab, set the script for the On Form Load property as follows:
// Get logged-on user information of the Active Directory User.
var virtualActorId = SFU.getVirtualActorId();
// Get the Extended Information for the user using the Virtual Actor ID.
// Here loggedOnUserInformation holds the property names of the provider.
var loggedOnUserInformation = SFU.getUserLookupExtendedInformation(virtualActorId);
// Populate the Text controls with the user information.
control.findById("T1").value = loggedOnUserInformation.UserDepartment;
control.findById("T2").value = loggedOnUserInformation.UserDesignation;
control.findById("T3").value = loggedOnUserInformation.UserDisplayName;
control.findById("T4").value = loggedOnUserInformation.UserDistinguishedName;
control.findById("T5").value = loggedOnUserInformation.UserEmail;
control.findById("T6").value = loggedOnUserInformation.UserId;
control.findById("T7").value = loggedOnUserInformation.UserManager;
control.findById("T8").value = loggedOnUserInformation.UserName;
control.findById("T9").value = loggedOnUserInformation.UserRole;
-