Skip to main content
Answer

how to get the value of current BranchID

  • December 4, 2021
  • 3 replies
  • 1134 views

Hi goog night.

 

I need to get the value of the current BranchId y use this propertie in my DAC.

    #region BranchID
public abstract class branchID : PX.Data.BQL.BqlInt.Field<branchID> { }
protected Int32? _BranchID;
[Branch()]
[PXDefault(typeof(AccessInfo.branchID))]

public virtual Int32? BranchID
{
get
{
return this._BranchID;
}
set
{
this._BranchID = value;
}
}
#endregion
In my screen i get the Br… (BranchID = 0)

can you help me please? thanks!!!

Best answer by Naveen Boga

Hi @eddiedaco ,

If you wanted to assign the current Branch, you can use below code.

var getCurrentBranchID =  Base.Accessinfo.BranchID;

 

if you wanted to assign the current branch ID as a default value at DAC.

#region UsrBranchID   

[PXDBInt()]
[PXDefault(typeof(AccessInfo.branchID))]
public virtual Int32? UsrBranchID {get; set;}
public abstract class usrBranchID : PX.Data.BQL.BqlInt.Field<usrBranchID> { }

#endregion

 

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • December 4, 2021

Hi @eddiedaco ,

If you wanted to assign the current Branch, you can use below code.

var getCurrentBranchID =  Base.Accessinfo.BranchID;

 

if you wanted to assign the current branch ID as a default value at DAC.

#region UsrBranchID   

[PXDBInt()]
[PXDefault(typeof(AccessInfo.branchID))]
public virtual Int32? UsrBranchID {get; set;}
public abstract class usrBranchID : PX.Data.BQL.BqlInt.Field<usrBranchID> { }

#endregion

 


  • Author
  • Varsity I
  • December 8, 2021

Hi @eddiedaco ,

If you wanted to assign the current Branch, you can use below code.

var getCurrentBranchID =  Base.Accessinfo.BranchID;

 

if you wanted to assign the current branch ID as a default value at DAC.

#region UsrBranchID   

[PXDBInt()]
[PXDefault(typeof(AccessInfo.branchID))]
public virtual Int32? UsrBranchID {get; set;}
public abstract class usrBranchID : PX.Data.BQL.BqlInt.Field<usrBranchID> { }

#endregion

 

Hi @Naveen B  the client declined to use this field. I cant test it.


Forum|alt.badge.img
  • Jr Varsity III
  • July 28, 2022

@Naveen Boga

Hi Naveen, do you know if it is possible to display in a report the branch id of the user pulling the report?