I am attempting to override Acumatica’s default Primary Item Validation logic. The base logic is done through an attribute, specifically the PrimaryItemRestrictorAttribute, which is subscribed to by the LocationAvailAttribute. So to override this, I made my own UsrPrimaryItemRestrictorAttribute and UsrLocationAvailAttributes, and figured I’d use the standard PXMergeAttributes attribute in the cache attached event in the graphs I would like to manipulate, effectively replacing the original attribute with my new ones on these screens. Below is an example of this in the INAdjustmentEntry graph. Remember the UsrLocationAvailAttributes subscribes to UsrPrimaryItemRestrictorAttribute.
sPXMergeAttributes(Method = MergeMethod.Append)]
PXRemoveBaseAttribute(typeof(LocationAvailAttribute))]
UsrLocationAvail(typeof(INTran.inventoryID), typeof(INTran.subItemID), typeof(INTran.siteID), typeof(INTran.tranType), typeof(INTran.invtMult))]
protected void INTran_LocationID_CacheAttached(PXCache sender) { }
Now when I test the logic it’s clearly running my code, but it seems to also run the code for the original attributes, which should be removed at this point. I can see this from the stack trace, which I’ll include below. As you can see it’s throwing the standard error that should appear with Acumatica’s default Item Validation logic, and is even referencing the original attribute in the stack trace, even though I can see it’s running my code from the screen and can step through it in the debugger.
Am I missing something? Maybe is there another reference to the LocationAvail attribute I’m missing? Any suggestions would be great, or if you have an alternate approach to adjusting attribute logic, I’m all ears. Thanks.