Skip to main content

Notifications

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

Clicked method paramters

Posted on by 572

Hi Experts,

I have a requirement that I have created a button on my form where I need to process the records based on a condition  when the user press the button. I don't know how to select the records in the clicked methods (in other words arguments for clicked method). 

Example:- SalesLine form, I need to select first 5 items by comparing line number with my counter and process them to update something else.

how to select the records of the respective sales order in the clicked method of the button ?

void clicked()
{

SalesLine   salesline;

super();

while select forupdate salesline where salesline.linenum <= MyCounter

{

// do some update;

}

}

how to pass arguments to select only particular sales order, Thanks in advance

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: Clicked method paramters

    Hi AX Beginner,

    If you are on the sales order form, you can get order number using "salesTable.SalesId". You also won't be able to use the variable salesLine in the clicked method as SalesLine is also the name of the data source.

    But since you are updating records, it might be a better option to create an action menu item and pass the data source as an argument. You can take a look at CheckCrediLimit button as an example. You can check the menu item (as highlighted) and the class it calls to check credit limit.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans