Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Inserting Grid's multi line data into another dialog form.

Posted on by 154
Hi,
I have created a dialog form /MultiPrint/ with a grid and have added the form to Menubutton /Multiselect/ in /salesTable/ form's action pane. 
Requirement is,  from the SalesLine grid the selected multilines, should be captured in my dialog form. 

I have written in my /MultiPrint/ form datasource init method as follows: But only one line is getting captured in dialog form. Is there any other approach?
.
public void init()
{
MultiPrintTableMultilineTable;
SalesLine     lsalesLine;
MultiSelectionHelper    helper = MultiSelectionHelper::construct();        
super();
FormDataSource multiLine = element.args().record().datasource();      
helper.parmDatasource(multiLine);            
lsalesLine = helper.getFirst();            
while(lsalesLine.RecId != 0)            
{            
MultilineTable.UnitOfMeasure = lsalesLine.SalesUnit;                    
MultilineTable.CustAccount = lsalesLine.CustAccount;                        
MultilineTable.insert();                            
lsalesLine = helper.getNext();
}
MultiPrintTable.linkPhysicalTableInstance(MultilineTable);
}
  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,547 Super User 2024 Season 1 on at
    Inserting Grid's multi line data into another dialog form.
    Hi, Can you share code written on clicked method of button in salesTable form. You can try looping SalesLine RecIds and sending in container as specified in the article shared before. In init method of your form, loop all RecIds, find SalesLine table buffer and insert record in your custom table.
  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    Inserting Grid's multi line data into another dialog form.
    Have you debugged the code? 
    What is the value of string control while passing it to parmArgs method?
    Also, on the init method of the dialog form does the container loops?
     
    Thanks,
    Girish S.
  • RSX Profile Picture
    RSX 154 on at
    Inserting Grid's multi line data into another dialog form.
    Hi Girish,
    I tried the same as per the blog.

    Still it is capturing only the last record that we select. Ex: if i select Line1,2,3 and click on the button, only the line 3 is being captured in the new form.
  • Verified answer
    GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    Inserting Grid's multi line data into another dialog form.
    Hi RSX,
     
    Refer to the below blog. You can override the clicked method of Multiselect button control.
    Inside the clicked method get the selected line from the grid - Insert into container and then convert the container to string separating each value by comma.
    You can then call the dialog form inside the clicked method along with string values inside the parm method.
    Refer to the below blog.
     
    Thanks,
    Girish S.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans