Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Create new record from...
Finance forum
Suggested answer

Create new record from grid action button

Posted on by 7
hi,
I have a custom master form with custom address grid, in address grid there is action pane with new button which is a dialog form.
My question is i want to creare more addresses (by dilaog form) against loaneeAccount (number seq) of loanee masterform.
how to pass value  of loanee account from master  form to child form so i create addresses against that loanee account. addressid/location Id is also number sequence.
now output is its just drop down of loanee account not selecting loanee ACCOUNT OF selected record.
i have written this code
 public void init() //dialog form init method
 {
     super();
     LoaneeAddress_ds.create(true);
     LoaneeAddress = element.args().record();
}

 [DataSource]
 class LoaneeAddress
 {
    public void executeQuery()
    {
       
            super();
    
        QueryBuildDataSource qbdsLoaneeAddress = LoaneeAddress_ds.query().dataSourceNo(1).addDataSource(tableNum(LoaneeAddress));
        QueryBuildRange qbrLoaneeAccount = qbdsLoaneeAddress.addRange(fieldNum(LoaneeAddress, LoaneeAccount));
            qbrLoaneeAccount.value(LoaneeAddress.LoaneeAccount); // i just trid here to set value of loaneeAccount//but not working 
       
    }
}


  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,305 Super User 2024 Season 2 on at
    Create new record from grid action button
    Hi,
     
    In the init of dialog form try to get header table record and assign the Account Id number to your address Datasource on the dialog form.
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,548 Moderator on at
    Create new record from grid action button
    Your approach doesn't work for this requirement. Instead when you are opening the dialog form, from caller formrun you need to get the header Loan Account and add that loan account as a value in the dialog fields.
  • CU22050920-0 Profile Picture
    CU22050920-0 7 on at
    Create new record from grid action button
    Martin Drab, LoaneeAccount exists in both tables so i have to apply range on it. yes you are right to assign value to tableField. (loaneeAddress.LoaneeAccount), but when i filter addresses?
  • Martin Dráb Profile Picture
    Martin Dráb 228,317 Most Valuable Professional on at
    Create new record from grid action button
    First of all, find out which form it is. Then look at how it's implemented, because you can't design a change without understanding what to change. For example, if the control is bound to a data source field, you need to assign a value to the table field.
     
    Your code tries to filter the addresses, which looks unrelated to your actual requirement.
     
    (Moved from D365 general forum.)

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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,435 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,317 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans