Caller of Lookup form

hello ,

I am looking for how to retreive the caller of my lookup form when this form is called from a lookup method (ax 2012)

thks :wink:

use args.caller();

I did it but it returns null as value of the caller ,

this is init method of my lookup Form

void init

{

caller = element.args().caller();

if(TradeFormHelper::isCalledFromForm(element.args(), formStr(MyForm)) )

//MyForm is the form that call the lookup form

{

if (formHasMethod(caller,identifierStr(parmRunBase)))

{

Myclass= caller.parmRunBase();

// myclass manages MyForm

}

switch Myclass.parmBuffer().TableId)

{

}

}

and this is my lookup method in MyForm:

public void lookup()

{

Args args = new Args();

FormRun formRun;

args.name(formStr(MyFormLookup));

formRun= new ClassFactory::formRunClassOnClient(args);

formRun.run();

this.performFormLookup(formRun);

}

thks

Just try this:

if (element.args() && element.args().caller())

{

// Make sure this was via a form.

if(SysDictClass::is(element.args().caller(), classnum(FormRun)))

{

// Cast the caller and make sure it is the right form.

callerForm = element.args().caller();

if (callerForm.name() == formstr(Form1))

{

allOpenPostedField.selection(Upgrade::All);

}

}

}

thks :wink: