Skip to main content
Answer

Get the currently logged CompanyID and BAccountID

  • November 27, 2023
  • 1 reply
  • 291 views

Forum|alt.badge.img

Hi All,

Need to know how to get the currently logged CompanyID and BAccountID in the graph extension.

Can someone help me out?

Thanks

Bhagya

Best answer by jinin

Hi @bhagyat25 
 

The Instance helper will provide the CompanyID
 int? companyId = PXInstanceHelper.CurrentCompany;

For UserId and Username, you can obtain them from the AccessInfo

 string userName = Base.Accessinfo.UserName;

1 reply

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • Answer
  • November 27, 2023

Hi @bhagyat25 
 

The Instance helper will provide the CompanyID
 int? companyId = PXInstanceHelper.CurrentCompany;

For UserId and Username, you can obtain them from the AccessInfo

 string userName = Base.Accessinfo.UserName;