Deprecated: Array and string offset access syntax with curly braces is deprecated in /www/wp-content/plugins/Ultimate_VC_Addons/admin/bsf-core/auto-update/admin-functions.php on line 11 Acumatica PXCheckUnique - Crestwood Associates

Acumatica PXCheckUnique

I was working on a client project in Acumatica and stumbled across the PXCheckUnique attribute.  This handy attribute allows the system to ensure that field values are unique that aren’t a part of the unique key defined for the table.

PXCheckUnique

Allows you to control unique values in a grid for a specified set of criteria.

Example:

[PXCheckUnique(Where = typeof(Where<CWUnitAssignLine.unitID, 
Equal<Current<CWUnitAssignLine.unitID>>, And<CWUnitAssignLine.assignType, 
Equal<Current<CWUnitAssignLine.assignType>>>>))]

When applied to a field in a DAC, it will cause the DAC to enforce uniqueness for that field for the current unit and assignment type. This is helpful when the unique key for the table might be some other combination of values.

There are other syntax formats that you can use. This would be identical except that it uses the ClearOnDuplicate flag to dictate how to handle a duplicate.

[PXCheckUnique(typeof(CWUnitAssignLine.unitID), typeof (CWUnitAssignLine.assignType) , 
typeof(CWUnitAssignLine.sortOrder),ClearOnDuplicate =true)]

For more information, you can access the Acumatica documentation here.  If you have further questions, email us at support@crestwood.com.

Leave a Reply