Reputation: 33
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
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") { }
}
}
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")]
Your selector is now filtered by the department constant:
Upvotes: 3