I’m trying to set the Company/Branch field of the Load Options(Load Documents) dialog from the Payments and Applications screen to default to the whole organization as opposed to a specific branch.
However, the field is configured with the OrganizationTree attribute, which doesn’t have an obvious way of overwriting the default.
Since this field resolves to a the Baccount of the branch or organization, I tried appending PXDefault(1), but no dice.
Anyone deal with this before?
Best answer by darylbowman
PXDefault by itself may not do it, because it probably is receiving a default value elsewhere
The new value must be a BAccountID from the Organization table
martinxfe wrote:
Anyone deal with this before?
No, but I was curious.
Try this, replacing “CAP” with your Company CD as a string:
publicclass Test : PXGraphExtension<ARPaymentEntry>
{
protectedvirtualvoid _(Events.FieldDefaulting<ARPaymentEntry.LoadOptions, ARPaymentEntry.LoadOptions.orgBAccountID> e, PXFieldDefaulting b)
{
ARPaymentEntry.LoadOptions row = e.Row;
if (row isnull) return;
b?.Invoke(e.Cache, e.Args);
Organization org = SelectFrom<Organization>.
Where<Organization.organizationCD.StartsWith<P.AsString>>.
View.Select(e.Cache.Graph, "CAP");
if (org isobject)
{
e.NewValue = org.BAccountID;
e.Cancel = true;
}
}
}
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.