How can I display the caller's information in the string control of the drop dialog form

Hello, everyone
Now I added a button called “Attach contract from customer” in the sales order form, like this:


After the user selects a sales order, clicking this button will enter a new form named “Contract Document List”, which will display all attachments of customers related to the selected sales order (Attachment from the customer, not from the sales order) :point_down:.
image
Then I added a Drop Dialog Form in “Contract Document List”, and I hope that the string control in this Drop Dialog Form can display the SalesId of the sales order that I have selected in the sales order form :point_down:.
image
I have no idea how to achieve this effect.
My next step is to select multiple rows of attachments in the Contract Document List and click the “OK” button in the Drop Dialog Form to copy all the selected attachments to the sales order.

Can you explain your problem, please? Do you mean that you don’t how to add a control to a drop dialog? Or how to get the order ID? Or do you mean something else?

Hi MartinDrab,
I’m sorry I didn’t express the problem clearly.
What I mean is, I want to display the SalesId of the sales order I initially selected in the string control of the dropdown dialog box form, but I don’t know how to do this.

So… do you know how to add a control to a form? If you do, we don’t have to talk about it and we need to identify the actual problem. If you don’t, let’s start with the basics first.

Hi @Delux_Chen,

Couldn’t you access this by accessing the element’s caller datasource? It should be something like this in init method of your custom form: SalesTable salesTableLocal = element.args().record() as SalesTable;

Yes, I know. I have already completed the Drop Dialog Form. The calling sequence of my form is: Sales Order Table → Contract Document List → Drop Dialog Form. Now I want to display the SalesId of the selected sales order from the Sales Order Table in the Drop Dialog Form. Since there is a Contract Document List between the Drop Dialog Form and the Sales Order Table, I don’t know how to achieve this.

I’m sorry @Vladimir_Danoski ,
The calling sequence of my form is: Sales Order Table → Contract Document List → Drop Dialog Form. I don’t know how to display data from the Sales Order Table in the Drop Log Form by accessing the element’s caller datasource. There is a Contract Document List between them.

Do things one by one. First of all, make sure you can access the SalesTable record in your Contract Document List. Without it you, you wouldn’t be able to get it in your drop dialog either.

Use a menu item button to open your Contract Document List from SalesTable. Set its Data Source property to SalesTable. Then in Contract Document List, call this.args().record() to get the SalesTable record.

When you have that, you have several options how to pass it to the drop dialog or fetch it from there. You could directly refer to caller’s caller:

FormRun callerForm = this.args().caller() as FormRun;
callerForm.args().record();

But you could also pass SalelsTable or SalesId through Args, have a method returning the value and call it from the drop dialog and so on.

It works, so the code can refer the caller’s caller. I learned this usage for the first time from your answer. Thank you for you help.

It’s possible, but this close coupling of these three forms may be undesirable. Maybe the drop dialog shouldn’t know how its caller form obtained the record. It makes a difference when you want to change the solution.