23 April 2023

Dynamics 365 F&O SysOperation Simple example

 

class FMCustService extends SysOperationServiceBase

{

   public void processCustomerData( FMCustContract _contract)

   {

       CustTable   custTable;

       AccountNum account = _contract.parmCustAccount();

 

       while select custTable

           where custTable.AccountNum == account

       {

           Info(strFmt("%1",custTable.AccountNum));

       }

   }

}

 

internal final class FMCustController extends SysOperationServiceController

{

   public static void main(Args _args)

   {

       FMCustController custController = new FMCustController(classStr(FMCustService),

               methodStr(FMCustService,processCustomerData),SysOperationExecutionMode::Synchronous);

       custController.startOperation();

   }

 

   /// <summary>

   ///

   /// </summary>

   /// <returns></returns>

   public ClassDescription caption()

   {

       ClassDescription ret;

   

       ret = "Customer base operation";

   

       return ret;

   }

 

}

[DataContractAttribute]

class FMCustContract

{

   CustAccount custAccount;

 

   [DataMemberAttribute(identifierStr(CustAccount)),

      SysOperationLabelAttribute(literalStr("Customer account")) ]

   public CustAccount parmCustAccount(CustAccount _custAccount = CustAccount)

   {

       custAccount = _custAccount;

 

       return custAccount;

   } 

}






 

No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...