How to automatically create Note record in Acumati

2019-06-05 23:33发布

I've noticed that whenever an AR Invoice gets saved, a record gets created in the Note table with the new invoice's note ID. Can you tell me how that is being accomplished? I'd like to get one of my screens to do the same thing. I guess there must be some kind of attribute on the either the DAC or the graph but I can't find it. I have the PXNote attribute on the NoteID column in my DAC but it does not cause a Note record to be automatically created.

Thanks for your help.

1条回答
叛逆
2楼-- · 2019-06-05 23:53

To have Note record automatically created when a new parent record gets saved, one should invoke the static PXNoteAttribute.GetNoteID<Field>(PXCache cache, object data) method when the parent record is inserted in the cache.

For example, to have Note record automatically created when a new Stock Item gets saved, you should subscribe to RowInserted handler for the InventoryItem DAC and call PXNoteAttribute.GetNoteID<Field>(...):

public class InventoryItemMaintExt : PXGraphExtension<InventoryItemMaint>
{
    public void InventoryItem_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
    {
        var noteCache = Base.Caches[typeof(Note)];
        var oldDirty = noteCache.IsDirty;
        PXNoteAttribute.GetNoteID<InventoryItem.noteID>(sender, e.Row);
        noteCache.IsDirty = oldDirty;
    }
}

The code snippet above can be incorporated into almost any custom BLC with a couple simple changes to replace InventoryItem with a custom DAC.

查看更多
登录 后发表回答