I need to find the current logged in user in my SAP B1 UI application. I tried to use the second method in the link below. But I am having the "Object reference not set to an instance of an object." error when I tried to get the main form with "GetForm()" method.
Private SBO_Application As SAPbouiCOM.Application
Dim oForm As SAPbouiCOM.Form
Dim oStatic As SAPbouiCOM.StaticText
Dim sLoggedInUser As String
oForm = SBO_Application.Forms.GetForm(169, 0) // "Object reference not set to an instance of an object."
oStatic = oForm.Items.Item("8").Specific
sLoggedInUser = oStatic.Caption
MsgBox("The current logged in User is " & sLoggedInUser)
Could you please help me with this issue or propose me another method to find the current logged in user with UI API.
Thanks in advance,