RE: Access elements declared in form scope from class extension
I did something similar with the form ReqTransPO. It has a form element declared as "ReqTransFormPO reqTransForm;" which I wanted to access from an extension class.
I did it with the following code:
[ExtensionOf(formstr(ReqTransPo))]
final class OABShowOrHideProdPool_Extension
{
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(formStr(ReqTransPo), formMethodStr(ReqTransPo, initDesign))]
public static void ReqTransPo_Post_initDesign(XppPrePostArgs args)
{
FormRun formRun = args.getThis();
ReqTransFormPO reqTransForm = formRun.getReqTransForm();
if (reqTransForm.parmReqRefType() == ReqRefType::BOMPlannedOrder)
{
formRun.ReqPO_OABProdPoolId().visible(true);
}
else
{
formRun.ReqPO_OABProdPoolId().visible(false);
}
}
public FormControl ReqPO_OABProdPoolId()
{
return ReqPO_OABProdPoolId;
}
public ReqTransFormPO getReqTransForm()
{
return reqTransForm;
}
}