Xavier LARTEM
Xavier LARTEM

Reputation: 139

Double condition with PXDefault

In the SOInvoice, I would like use a double condition for this field : PX.Objects.SO.SOLine - TaxCategoryID

If the branchid=5 and TaxCategoryID=1000 then TaxCategory=2000 I don't know if I must use the event, or the attribut configuration.

Thanks

[PXDefault(typeof(Search<InventoryItem.taxCategoryID,
Where<InventoryItem.inventoryID, Equal<Current<SOLine.inventoryID>>>>),
PersistingCheck = PXPersistingCheck.Nothing, SearchOnDefault = false)]

Upvotes: 0

Views: 224

Answers (1)

Chris H
Chris H

Reputation: 765

SOLine_InventoryID field updated event calls SetDefaultExt to the tax category field. You could write an override at the graph level for TaxCategory like this....

protected virtual void _(Events.FieldDefaulting<SOLine, taxCategoryID> e, PXFieldDefaulting baseMethod)
{
    SOLine row = e.Row as SOLine;
    if (row.BranchID) == 5
          e.NewValue = "1000";
    else
          e.NewValue = "2000"
}

This is pseudo-code but I think you see how it functions. Be sure to include the delegate, so that only your override executes and not thebase FieldDefaulting event

Field Defaulting Event per Acumatica Wiki

Upvotes: 1

Related Questions