I need to pass caller forms master datasource's values

Hello Everyone,

I have a form in which the first frame is the master table, and the second frame is details table. In details frame I have a button for displaying selected value in a details datasource, in the original form of the details’ table. But also, I need to pass value of the selected master record at the same time.

What do I need to use? args.caller() object? or something else.

Please help me.

Thanks

Erdem

Why can’t you just get the master record by a foreign key on the details record?

It is Axapta Original table and unfortunately it is a bit complicated.

It is activity table in the CRM module. Its relation with other tables like BusinessRelation,ContactPerson etc. is established with other table that is smmActivityParentLinkTable.

So, I just can not get the master record by a foreign key on the details record.

Hi Erdem,

Doesnt element.args().record() return you the selected record from the Master form?

Hi Zubair,

element.args().record() return me the detail table. Not master form.

OK, so I see three ways:

  1. Use smmActivityParentLinkTable as record to be trasferred in args. It’s enough to get both smmActivities record and the parent record.
  2. Set smmActivityParentType value as args.parmEnum (because AcivityNumber and ParentType is PK of smmActivityParentLinkTable)
  3. Use parm.object() - I’ve never used it for such scenario, but I see no reason why it should’t work

Hi Martin,

Correct me If I am wrong,

  1. I am not able to take smmActivityParentLinkTable I tried but it does not work. Although the ds of smmActivityParentLinkTable exists in my form , it is not passed as an args.

  2. I do not know how to use this way. I have the datasource in the form but I do not use anywhere. It just joined by my Table that is actually the master table.

  3. I have used element.args().record() but it did not work. I am not sure it works, since it is also using args. Isn’t it?

Best Regards

Erdem

Well, I’m not sure how much do you know about Args…

You can define which data source is passed to the menu item by setting DataSource property on the menu item button.

If this is not a solution for any reason, you need to build and pass Args by yourself. Typically, overwrite the clicked() method and place code like this into it:

Args args = new Args();
MenuFunction menuFunction = this.menuFunction();
;
//set a record
args.record(smmActivities);
//set an enum value
args.parmEnumType(enumNum(smmActivityParentType));
args.parmEnum(smmActivityParentLinkTable.ParentType);
//set an object
args.parmObject(element);
//call the menu item with args
menuFunction.run(args);