How to identify caller form name

Hi,

I am calling a simple form A , from a ListPage Form B. when in init method of form A, I wrote the following code, it is not going inside of the if condition.

if(element.args().caller() && element.args().caller().name() == formstr(B)

{

// mY LOGIC

}

The program is not going inside the if condition. Please guide.

How you are calling form A? What element.args().caller().name() is returning?

Here is my code:

Identifier name callerName;

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

I am getting an error:

Object Object not initialised.

It could be that there is no caller. Check if (element.args().caller())
You haven’t said how you are calling the form A from form B.

Hi Kranthi,

May I know the need of calling the form A, from form B, my purpose only finishes, if form A is opened by form B (List Page form). I checked, in if (element.args().caller()), the program is not going inside if condition, thus my logics are unexecuted.

Usually your code should work.But it also depends how you are calling form A.

Args args;
FormRun formRun;
;
super();
args = new args(formstr(FormB)); // sending Args(record) to FormB
args.record(SampleTable);
formrun = classfactory.formrunclass(args);
formrun.init();
formrun.run();
formrun.wait();
formrun.detach();

Okay, then the problem is clear. You’re not setting any value to args.caller(), so you can’t expect to find anything there later.

You said you are calling form A from Form B,. Right?
Anyway try by setting the caller, args.caller(element);

Hi,

Can you please be clear, what I have to do :

In clicked method of form B , I wrote the following:

void clicked()
{

Args args;
FormRun formRun;
;
super();
args = new args(formstr(A));
args.parm(“Test”);
formrun = classfactory.formrunclass(args);
formrun.init();
formrun.run();
formrun.wait();
formrun.detach();

}

In Init method of form A

if(element.args().parm() == “Test”)
{
info(“ABCD”);

}

But still the solution remains, please let me know the correction.

We told you to set the caller.You haven’t set the caller.

args = new args(formstr(A));
args.caller(element); // add this line

Thanks, I tried, but it is still not working.

so what does the element.args().caller().name(); returns?

Getting error: Object object not initialised.

I declared :

str name;

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

Getting error: Object object not initialised.

any idea?

I’m still not sure how your implementation looks. Can you create trivial example (without any unrelated code), export it and share the project, or describe exactly what you did so we can follow the steps and try to reproduce your problem?

Thanks Martin, my issue is resolved.

rose_henry,

how you resolved please tell. i am also having similar requirement. when u click on create new customer(dirpartyquickcreateform) , when i click on save i am calling custtable form to insert the address info. i need some fields to be set mandatory on dirpartyquickcreateform. any suggestions pls