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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Parameter box is not getting refreshed and the current Salesid is not getting stored

(0) ShareShare
ReportReport
Posted on by
Hello All,
I need to calculate the Advance Payment Amount for the lines of the selected salesId.
I have created a Menu item button for the dialog box and added two parameters, one of which is salesId, and the other is Advance Payment.
SalesId needs to be auto-filled when the button is clicked, and the Advance Payment will be filled manually.
And also, I have created the Contract class and the service class.
And then the calculated value will be stored in the Advance payment field in SalesLine. 
The calculation part and the storing of the value are working fine, but the problem is with auto-filling the salesId and refreshing the parameter box each time it is opened.
This is my code snippet:
public static void main(Args _args)
{
    AdvPayController controller = new AdvPayController();
    controller.parmClassName(classStr(AdvPayService));
    controller.parmMethodName(methodStr(AdvPayService, process));
    controller.parmArgs(_args);
    controller.parmDialogCaption("Advance Payment");
    controller.startOperation();
}
protected void initializeContract()
{
    //super();
    AdvPayContract contract = this.getDataContractObject();
     // Always reset the dialog fields
    contract.parmAdvancePay(0);
    Args localArgs = this.parmArgs();
    if (localArgs
        && localArgs.record()
        && localArgs.record().TableId == tableNum(SalesTable))
       {
          SalesTable salesTable = localArgs.record();
          contract.parmSalesId(salesTable.SalesId);
       }
 }
 protected void apply()
 {
 }
 public void run()
 {
      super();
      this.refreshSalesLines();
 }
 private void refreshSalesLines()
 {
      Args _argsLocal = this.parmArgs();
      if (_argsLocal
          && _argsLocal.caller()
          && _argsLocal.caller() is FormRun)
      {
         FormRun formRun = _argsLocal.caller();
         FormDataSource salesLineDss = formRun.dataSource(formDataSourceStr(SalesTable, SalesLine));
         if (salesLineDss)
         {
              salesLineDss.research(true);
              salesLineDss.refresh();
         }
      }
 }
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    238,550 Most Valuable Professional on at

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
BillurSamdancioglu Profile Picture

BillurSamdancioglu 95 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans