Hello,
I have a custom form where I recently added line details (financial dimensions) as shown in the attached image now, I would like to customize the BudgetCode field (return some of records).
The system automatically generates a control name like this: LineDimensionEntryControl_DECValue_Budgetcode but the code I'm using is unable to find this control.
Is this approach correct, or is there another recommended way to access or customize this control?
Thank you.
[FormEventHandler(formStr(MyFormHeader), FormEventType::Initialized)]
public static void MyFormHeader_OnInitialized(xFormRun sender, FormEventArgs e)
{
try
{
FormRun formRun = sender as FormRun;
FormStringControl budgetCodeControl = formRun.design().controlName("LineDimensionEntryControl_DECValue_Budgetcode") as FormStringControl;
if (budgetCodeControl)
{
budgetCodeControl.registerOverrideMethod(
methodStr(FormStringControl, lookup),
methodStr(MyFormHeaderLookUp_Extension, customBudgetCodeLookup),
formRun
);
}
else
{
info("Control not found or is not a DimensionEntryControl.");
}
}
catch
{
info('Error...');
}
}