@development93 Two things..
- Your Form should be added with Properly called MarkRequired="Dynamic"
- And add the SetRequired and SetPersistingCheck code in the RowSelected event.
Here is the KB article to make the field mandatory dynamically based on the conditions.
https://asiablog.acumatica.com/2016/05/dynamically-changing-attribute-property.html
https://stackoverflow.com/questions/58012786/pxpersistingcheck-nullorblank-set-at-run-time
Hope this helps!
@development93
Write the below code in RowSelected event.
PXDefaultAttribute.SetPersistingCheck<DAC.Field>(pxcache, data, PXPersistingCheck.NullOrBlank).
Make sure that AFE number field contains PXDefault attribute.