add this logic into your lookup method and pass dimensionAttributeName = your dimension nameArgs args;
FormRun lookupFormRun;
DimensionAttribute dimAttr;
Object object;
Name dimensionAttributeName;
LTFinDimLink ltFinDimLink;
select * from ltFinDimLink;
if(FinDimLink.DimensionForColor)
{
dimensionAttributeName = FinDimLink.color;
}
if (_ctrl != null)
{
// Construct arguments for the custom lookup
args = new Args();
args.name(formStr(DimensionDefaultingLookup));
args.lookupValue(_ctrl.text());
args.caller(_ctrl);
// Find the dimension attribute associated with the string control which called this method
dimAttr = DimensionAttribute::findByLocalizedName(dimensionAttributeName);
args.lookupField(dimAttr.ValueAttribute);
args.record(dimAttr);
// Run the custom lookup and init the lookup form
lookupFormRun = classfactory.formRunClass(args);
lookupFormRun.init();
// Specify this is the callback on the lookup form by casting the
// form to an object and late binding the setResultCallback method
if (SysFormRun::hasMethod(lookupFormRun, identifierStr(setResultCallback)))
{
object = lookupFormRun;
object.setResultCallback();
}
_ctrl.performFormLookup(lookupFormRun);
No comments:
Post a Comment