Skip to main content
Solved

How to prevent selecting certain invoices in Invcoice Entry using customization?

  • January 28, 2026
  • 1 reply
  • 53 views

mos11
Freshman I
Forum|alt.badge.img

I want to change the Invoice main document view and add a condition with a join so that I select only those invoices that belong to the branch set as the current logged-in user’s DefBranchID in UserPreferences.

Best answer by Marat43

Hi,

Have you tried this approach?
 

   [PXViewName("AR Invoice/Memo")]
[PXCopyPasteHiddenFields(new Type[] { typeof(ARInvoice.invoiceNbr) }, FieldsToShowInSimpleImport = new Type[] { typeof(ARInvoice.invoiceNbr) })]
public SelectFrom<ARInvoice>. LeftJoin<Customer>. On<Customer.bAccountID.IsEqual<ARInvoice.customerID>>
.LeftJoin<UserPreferences>
.On<UserPreferences.userID.IsEqual<AccessInfo.userID.FromCurrent>>
.Where<ARInvoice.docType.IsEqual<Optional<ARInvoice.docType>>.And<ARInvoice.origModule.IsEqual<BatchModule.moduleAR>
.Or<ARInvoice.origModule.IsEqual<BatchModule.moduleEP>>
.Or<ARInvoice.released.IsEqual<True>>>.And<Customer.bAccountID.IsNull.Or<Match<Customer, AccessInfo.userName.FromCurrent>>>
.And<ARInvoice.branchID.IsEqual<UserPreferences.defBranchID>
.Or<UserPreferences.defBranchID.IsNull>>>.View Document;

 

1 reply

Forum|alt.badge.img
  • Jr Varsity I
  • Answer
  • January 28, 2026

Hi,

Have you tried this approach?
 

   [PXViewName("AR Invoice/Memo")]
[PXCopyPasteHiddenFields(new Type[] { typeof(ARInvoice.invoiceNbr) }, FieldsToShowInSimpleImport = new Type[] { typeof(ARInvoice.invoiceNbr) })]
public SelectFrom<ARInvoice>. LeftJoin<Customer>. On<Customer.bAccountID.IsEqual<ARInvoice.customerID>>
.LeftJoin<UserPreferences>
.On<UserPreferences.userID.IsEqual<AccessInfo.userID.FromCurrent>>
.Where<ARInvoice.docType.IsEqual<Optional<ARInvoice.docType>>.And<ARInvoice.origModule.IsEqual<BatchModule.moduleAR>
.Or<ARInvoice.origModule.IsEqual<BatchModule.moduleEP>>
.Or<ARInvoice.released.IsEqual<True>>>.And<Customer.bAccountID.IsNull.Or<Match<Customer, AccessInfo.userName.FromCurrent>>>
.And<ARInvoice.branchID.IsEqual<UserPreferences.defBranchID>
.Or<UserPreferences.defBranchID.IsNull>>>.View Document;