Hi,
while creating a free text invoice, when I choose a customer account, it will update the default Dimension (Business unit) in the free text invoice Header. I have created a custom field HSHTSiteId in CustInvoiceTable which has InventSiteID as EDT.
My requirement is when I modify HSHTSiteId & choose some other value then default Dimension in free text invoice Header must be updated to the default dimension related to HSHTSiteId as InventSiteID has default Dimension related to it.
I have write onModified Event Handler on CustInvoiceTable:
public static void CustInvoiceTable_HSHTSiteId_OnModified(FormControl sender, FormControlEventArgs e)
{
CustInvoiceTable custInvoiceTable;
FormRun element = sender.FormRun();
FormStringControl siteID = element.design().controlName(formControlStr(CustFreeInvoice,CustInvoiceTable_HSHTSiteId));
select custInvoiceTable;
if (siteID)
{
custInvoiceTable.DefaultDimension = LedgerDimensionDefaultFacade::serviceMergeDefaultDimensions(custInvoiceTable.DefaultDimension, InventSite::find
(custInvoiceTable.HSHTSiteId).DefaultDimension);
}
}
But the Default Dimension value is not updating in Freetextinvoice Header. I debug the code & found getting 0 value returned.


Can anyone suggest How can I do this.
Thanks
Rahul