Skip to Content
0
May 12, 2015 at 01:30 PM

SAP Business One SDK UI API finding current logged in user

981 Views

Hello Experts,

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.

How to track who is the current user logged into SAP Business One?

My Code;

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,

Atilla