pmfith
pmfith

Reputation: 909

Attribute [PXNotPersistable] doesn't exist in version 6.1

I'm upgrading a customization project from version 5.3.2936 to version 6.10.0755. I've run into an attribute: [PXNotPersistable] which, apparently, no longer exists. I don't know what this attribute does or if there is a replacement. It's used to decorate a PXSselectJoin BQL statement. Any help would be appreciated.

Upvotes: 0

Views: 50

Answers (1)

RuslanDev
RuslanDev

Reputation: 6778

The PXNotPersistable attribute was completely removed from the Acumatica Framework mostly because it was not used anywhere inside Acumatica ERP solution.

Below is the implementation of PXNotPersistableAttribute:

public sealed class PXNotPersistableAttribute : PXCacheExtensionAttribute
{
    protected override void AddHandlers(PXCache cache)
    {
        cache.RowPersisting += (sender, args) => args.Cancel = true;
    }
}

As you might notice, the attribute was quite basic and didn't do much: only prevented modified records of the main data view DAC from beings saved to a database.

Say, you have a custom data view declared as follows for ver. 5.3:

[PXNotPersistable]
public PXSelectJoin<MyDacA, 
    LeftJoin<MyDacB, On<MyDacB.someField, Equal<MyDacA.someField>>>> DataView;

For ver. 6.1, PXNotPersistableAttribute can be simply replaced with the MyDacA_RowPersisting handler (since MyDacA is the main DAC for our data view and only changes made to this DAC will be saved to a database):

public void MyDacA_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
{
    e.Cancel = true;
}

Upvotes: 1

Related Questions