Skip to main content
Solved

How to prevent selecting certain order numbers in Sales Order Entry using customization?

  • January 22, 2026
  • 34 replies
  • 242 views

Show first post

34 replies

darylbowman
Captain II
Forum|alt.badge.img+16

What version of Acumatica are you using?


mos11
Freshman I
Forum|alt.badge.img
  • Author
  • Freshman I
  • January 26, 2026

@nadiyahnatyuk58 If I use role security by branch, users are not allowed to see warehouses from other branches, and that is a problem.


mos11
Freshman I
Forum|alt.badge.img
  • Author
  • Freshman I
  • January 26, 2026

@darylbowman 25.101.0153.

 


darylbowman
Captain II
Forum|alt.badge.img+16

 In 25 R1, the original BQL looks like this:

[PXViewName(Messages.SOOrder)]
[PXCopyPasteHiddenFields(typeof(SOOrder.showDiscountsTab))]
public PXSelectJoin<SOOrder,
LeftJoinSingleTable<Customer, On<Customer.bAccountID, Equal<SOOrder.customerID>>>,
Where<SOOrder.orderType, Equal<Optional<SOOrder.orderType>>,
And<Where<Customer.bAccountID, IsNull,
Or<Match<Customer, Current<AccessInfo.userName>>>>>>> Document;

Your desired BQL (according to you) looks something like this:

...I want to add something like the second code...

[PXViewName("Sales Order")]
[PXCopyPasteHiddenFields(new Type[] { typeof(SOOrder.showDiscountsTab) })]
public PXSelectJoin<SOOrder, LeftJoinSingleTable<Customer, On<Customer.bAccountID, Equal<SOOrder.customerID>>>, Where<SOOrder.orderType, Equal<Optional<SOOrder.orderType>>, And<Where<Customer.bAccountID, IsNull, Or<Match<Customer, Current<AccessInfo.userName>>>>>>> Document;
.LeftJoin<UserPreferences>
.On<UserPreferences.userID.IsEqual<AccessInfo.userID.FromCurrent>>
.Where<
Where<
SOOrder.orderType.IsEqual<SOOrder.orderType.AsOptional>
.And<Where<Customer.bAccountID, IsNotNull>>
.And<SOOrder.branchID.IsEqual<UserPreferences.defBranchID.FromCurrent>
.Or<UserPreferences.defBranchID.FromCurrent.IsNull>>

.Or<Exists<Select<SOOrderType, Where<SOOrderType.orderType, Equal<SOOrder.orderType>, And<SOOrderType.aRDocType, Equal<ARDocType.noUpdate>, And<SOOrderType.behavior, In3<SOBehavior.sO, SOBehavior.tR>>>>>>>
>
>
.OrderBy<Asc<SOOrder.orderNbr>>

 

So I repeat, what is this code block supposed to be doing?

.Or<Exists<Select<SOOrderType, Where<SOOrderType.orderType, Equal<SOOrder.orderType>, And<SOOrderType.aRDocType, Equal<ARDocType.noUpdate>, And<SOOrderType.behavior, In3<SOBehavior.sO, SOBehavior.tR>>>>>>>
>
>

 


mos11
Freshman I
Forum|alt.badge.img
  • Author
  • Freshman I
  • January 26, 2026

@darylbowman It looks like I made some mistakes. Okay, now can you help me change this view so that it works exactly the way I want?


darylbowman
Captain II
Forum|alt.badge.img+16
  • Answer
  • January 26, 2026

Try this:

[PXViewName(Messages.SOOrder)]
[PXCopyPasteHiddenFields(typeof(SOOrder.showDiscountsTab))]
public SelectFrom<SOOrder>
.LeftJoin<Customer>
.On<SOOrder.customerID.IsEqual<Customer.bAccountID>>
.LeftJoin<UserPreferences>
.On<UserPreferences.userID.IsEqual<AccessInfo.userID.FromCurrent>>
.Where<SOOrder.orderType.IsEqual<Optional<SOOrder.orderType>>
.And<Customer.bAccountID.IsNull
.Or<Match<Customer, AccessInfo.userName.FromCurrent>>>
.And<SOOrder.branchID.IsEqual<UserPreferences.defBranchID>
.Or<UserPreferences.defBranchID.IsNull>>>.View Document;

If you don’t already have it defined, you’ll need to add this ‘using’ statement:

using PX.Data.BQL.Fluent;

 


mos11
Freshman I
Forum|alt.badge.img
  • Author
  • Freshman I
  • January 27, 2026

Try this:

[PXViewName(Messages.SOOrder)]
[PXCopyPasteHiddenFields(typeof(SOOrder.showDiscountsTab))]
public SelectFrom<SOOrder>
.LeftJoin<Customer>
.On<SOOrder.customerID.IsEqual<Customer.bAccountID>>
.LeftJoin<UserPreferences>
.On<UserPreferences.userID.IsEqual<AccessInfo.userID.FromCurrent>>
.Where<SOOrder.orderType.IsEqual<Optional<SOOrder.orderType>>
.And<Customer.bAccountID.IsNull
.Or<Match<Customer, AccessInfo.userName.FromCurrent>>>
.And<SOOrder.branchID.IsEqual<UserPreferences.defBranchID>
.Or<UserPreferences.defBranchID.IsNull>>>.View Document;

If you don’t already have it defined, you’ll need to add this ‘using’ statement:

using PX.Data.BQL.Fluent;

 

Thank you, this really helps.


mos11
Freshman I
Forum|alt.badge.img
  • Author
  • Freshman I
  • January 27, 2026

@darylbowman Can you help me i want do same for SO Invoice Entry


darylbowman
Captain II
Forum|alt.badge.img+16

Please start a new question. You can reference this one and tag me.