Solved

Conditional PXRestrictor on Look up

  • 9 February 2024
  • 1 reply
  • 34 views

Hi,

 

I am looking for a solution where I have a Boolean value on the user, the value will state if all the warehoused should be available for the user when selecting the warehouse for the current branch.

if the bool is true then we I want to only show the current rows branch's warehouses and not all the warehouses in the system. but if the bool is false I don't want the where clause to be part of the PXRestrictor. 

 

I cant control a PXRestrictor with a bool and this is the problem i don't always want to apply the where clause to the look up field. 

 

Current Code

  #region SiteID  
  [PXMergeAttributes(Method = MergeMethod.Append)]
  [PXRestrictor(typeof(Where<INSite.branchID, Equal<Current<SOLine.branchID>>>), "", typeof(INSite.siteID))]

  public int? SiteID { get; set; }
  #endregion

 

I have a bool on the same DAC usrWarehouseLock and if this is true then apply the current PXRestrictor and is false ignore and just continue with the normal functionality. 

 

Any help will be amazing thanks. 

 

icon

Best answer by darylbowman 9 February 2024, 16:37

View original

1 reply

Badge +11

Have you tried something like:

[PXRestrictor(typeof(Where<usrWarehouseLock.IsEqual<True>.
And<INSite.branchID.IsEqual<SOLine.branchID.FromCurrent>>>),
"", typeof(INSite.siteID))]

(this uses PX.Data.BQL.Fluent)

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved