0
votes

User requirement is to create duplicate customer field in Invoice screen and that custom field is using for some historical data, But by default we are passing current Invoice customer value and later we are allowing user to change the custom field.

so in this case is there a way to set the value for existing records through code with out refreshing/modifying the existing record.

I have tried by using field level PXDefault attribute but that will not work in my case so their any events or some code to update custom field value for existing fields.

Thanks in advance.

1
If you want to use PXDefault with an existing record, you need to call SetDefaultExt to force reapplying that default logic. There are many ways to update the data, depending on what you need. When I need to do this as a one-time event, I usually just us a SQL statement to update values where the current field is blank or null.Brian Stevens

1 Answers

0
votes

I believe PXDefault would only execute when a new Row is being inserted. Perhaps one option could be to explicitly call cache.SetDefaultExt(e.Row) if value is null, but I am not sure whether it is 'legal' to do it on a row Selected

One other possibility is to use Generic Inquiry Mass Update (https://asiablog.acumatica.com/2016/09/mass-processing-using-gi.html). This way to could perhaps update past records in bulk. But be careful of Acumatica Transaction License limits.