web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

Adding multiple lines to a custom form

(0) ShareShare
ReportReport
Posted on by 150

Hi,

I have a custom form similar to a SalesTable form which shows header and line records. There's the "Add line" button which adds only one line at a time. I'd like to add a button called "Add lines" which will open a dialog form with a grid to select records that I would like to add as new lines to my main custom form. In addition to that, I need to be able to open the SysQueryForm from my dialog form in order to specify query filter criteria. Similar functionality already exists on SalesTable form which invokes the SalesQuickQuote form via "Add lines" button to select multiple records and to define query criteria. Do you have any tips how to accomplish this or do you know about any related blogs/posts?

Thank you 

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Do you have any particular question? Do you have a problem with creating the form? Inserting records? Showing the dialog for query ranges? Something else?

  • qianwang Profile Picture
    7,168 on at

    Hi silentsquirrel,

    Please go to the Forms \ SalesQuickQuote \ Methods \ doApplyToSalesTable.

    It calls the salesLine.createFromTmpFrmVirtual method of table Salesline.

    Please have a look at these method write the similar codes.

    154.png

    Regards,

    QianQW

  • silentsquirrel Profile Picture
    150 on at

    Hi Martin,

    I have the following two questions remaining:

    1. I created a dialog form similar to SalesQuickQuote and added a Filter control that invokes the SysQueryForm in order to apply filters. However, the criteria record that references my dialog data source displays only 1 value multiple times. I suspect that I need to build my query correctly on the dialog form. If so, is there a guide how to do it?  

    2. How do I insert selected records back to my custom form from the dialog form when I press the OK button?

    Thank you

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    1. Can you give us a screenshot, please? It's not clear to me what's duplicated. Don't forget that you told us nothing about your implementation, therefore we don't know how you've built the query and what you mean by referencing dialog data. We need more information from you.

    2. It depends on what you do in the form. For example, if you merely define a query to another table, you'll run the query and create lines for what you get. If you use a temporary table, you'll iterate records in this table and create lines for them. For sure focus on inserting date to tables, not to forms. Forms merely visualize the data; they don't store them. You'll insert data to a table and then just refresh the form data source.

  • silentsquirrel Profile Picture
    150 on at

    1. There's a main custom form with header and line data sources Tbl1 and Tbl2 respectively. There's a new Add lines button which invokes a new dialog form with a grid and data source Tbl3. No query was added at this point yet since. There are no predefined filters and all records from Tbl3 are displayed once the dialog form opens. A control was added which invokes the  SysQueryForm. However, only one record from Tbl3 is displayed multiple times in the criteria dropdown.

    2. I meant inserting records to the table behind a form, sorry for bad wording. Records will be created in Tbl2 based on what records are selected on the dialog form grid (Tbl3)

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    1. Please tell us what your control does ("A control was added which invokes the  SysQueryForm"), especially which query you're using. Is there a problem with showing as a screenshot of the ranges?

    If you take the the query from Form2, what ranges do you have there? To find it, open Options > Advanced filter or sort. If you see the same ranges there, you control works correctly but your assumptions about the query are wrong.

    2.What the actual problem? Do you know how to set field values, insert records and such things? If not, let's learn things one by one, instead of trying to do deal with ten other problems at once.

    If you know basics, I guess the biggest problem may be getting select records. But what exactly do you mean by "selected"? All records returned by the filtered query, only records highlighted in the grid or records marked by ticking a checkbox, for instance?

    If you mean the query, use the QueryRun object returned from Tbl3_ds.queryRun() to iterate the records. If highlighted records, use MultiSelectionHelper. If using a checkbox, it depends on how it's implemented (e.g. it may be a temporary table or an edit method populating a Set object).

    We'll have a more concrete and helpful discussion if you start giving us more information.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Siv Sagar Profile Picture

Siv Sagar 266 Super User 2025 Season 2

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 213 Super User 2025 Season 2

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 140 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans