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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Passing multiple records from one form to another

(0) ShareShare
ReportReport
Posted on by 634

Hi Experts,

I have a customized form which has two data sources Header Table and Line Table. When I create a record in my form and select the salesId in a field in the header part it should show the lines associated with the salesId in the bottom (Line table) of the form. I was trying to get it done using below code in the modified method of the field salesId in the datasource. I am not sure if this is the proper way to do it and I have an issue here that if i select the same salesid multiple times before saving the record it will create unnecessary records in the line table since the insert is called each time when the field is modified. what is the best way to achieve it ?

public void modified()
{
SalesTable salesTable;
Salesline salesLine;

super();

select salesTable where salesTable.salesId == MyTable.salesId;

MyTable.salesId = salesTable.salesId
MyTable.CustReference = salesTable.custReference

while select salesLine where salesLine.salesId
{
MyTable.salesId = salesLine .salesId
MyTable.ItemId = salesLine.ItemId
MyTable.insert();
}
}

I have the same question (0)
  • Suggested answer
    greengrimms Profile Picture
    1,400 on at

    Hi!

    Is there a reason why you're using a custom table instead of the original (SalesLine) as a datasource?

    I think what you need is to link both parent and child datasource, in order to show the data related to the SalesLine in the details.

    That can be done by associating header and lines in the datasources properties. Select the lines datasource, and on the properties, select the header datasource as Join Source.

    Another thing I would do is just use the original SalesLine table as datasource, if this is only for displaying purposes.

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    modified is not the right place for this operation. The user did not save the record. He/she can change the selection, or completely abandon it, etc.

    You can write it in the insert method of the table. Also, if you open the salesLineRecId field on the line and add a check before creating the record, you will prevent duplicate records.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans