jckta
jckta

Reputation: 33

Acumatica Customize Owner Selector

Is it possible to hardcode and filter by a specific department in the "Owner" selector in Acumatica?

DAC: AR.Arinvoice

OwnerID

[PXDBGuid()]

[PXDefault(typeof(Customer.ownerID), PersistingCheck = PXPersistingCheck.Nothing)]

[PXOwnerSelector(typeof(ARInvoice.workgroupID))]

[PXUIField(DisplayName = "Owner", Visibility = PXUIVisibility.SelectorVisible)]

Upvotes: 1

Views: 651

Answers (1)

Hugues Beauséjour
Hugues Beauséjour

Reputation: 8278

Yes you can add filters to Selector using the PXRestrictor attribute.

Use a CODE file to declare the owner department constant you want to filter on:

namespace PX.TM
{
  public class AdminDepartment : PX.Data.Constant<string>
  {
     public AdminDepartment() : base("ADMIN") { }
  }
}

enter image description here

Extend OwnerID DAC field to append (merge) the existing attributes with your new PXRestrictor filter. You can use either CacheAttached method in code or the Customization Project Editor DATA ACCESS section to append attributes to the DAC field:

[PXRestrictor(typeof(Where<PX.TM.PXOwnerSelectorAttribute.EPEmployee.departmentID, Equal<PX.TM.AdminDepartment>>), 
              "Owner Department Filter")]

enter image description here

Your selector is now filtered by the department constant: enter image description here

Upvotes: 3

Related Questions