Find Root Caller Form
Recently I faced the situation where I want the root caller form name from the ladder of forms opened one after one, from each other. And for that I didn’t find any solution on internet so mind clicked and made one solution for that. Hope it’s useful.
We have FORM-A and FORM-B, FORM-A is root form means FORM-B is opened from FORM-A, and FORM-B opened FORM-B again and again.
In above scenario, if we need the root caller name then we have to implement the below logic,
We have FORM-A and FORM-B, FORM-A is root form means FORM-B is opened from FORM-A, and FORM-B opened FORM-B again and again.
In above scenario, if we need the root caller name then we have to implement the below logic,
- You have to make one parm method in the FORM-B for caller form like below
IdentifierName parmCallerName(IdentifierName _callerName = callerName) { callerName = _callerName; return callerName; }
- Now add below logic into the init method of FORM-B
if (element.args().caller() && element.args().caller().name() == formStr(A)) { this.parmCallerName(element.args().caller().name()); } else if(element.args().caller() && element.args().caller().name() == formStr(B)) { formRunCaller = element.args().caller(); this.parmCallerName(formRunCaller.parmCallerName()); }
So now every time you use that parm method of FORM-B in this scenario, you can get the root caller form name.
Enjoy
Enjoy
Comments
Post a Comment