Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Wednesday, August 16, 2023

Code to call the caller form refresh in D365

 Hi,

can use the below code snippets in Controller or any other class called from

        #Task

        FormRun formRun;


        formRun = element.args().caller(); //  args.caller();

        if(formRun)

               formRun.task(#taskF5);

   

Regards,

Tuesday, June 20, 2023

X++ code to get ExchRate() in D365

 hi,


  public ExchRate exchRate(

        CurrencyCode _fromCurrency,

        CurrencyCode _toCurrency = Ledger::find(Ledger::current()).AccountingCurrency,

        TransDate    _transDate = today(),

)

    {

        ExchangeRate     exchangeRate;

        ExchangeRateType ExchangeRateType;

        ExchangeRateCurrencyPair exchangeRateCurrencyPair;

        real             exchRate;


        CurrencyCode fromCurrency  = this.CurrencyCode;

        TransDate    transDate     = this.TransDate;


        select firstonly exchangeRateCurrencyPair   where

        exchangeRateCurrencyPair.ExchangeRateType == Ledger::find(Ledger::current()).DefaultExchangeRateType

        &&  exchangeRateCurrencyPair.FromCurrencyCode == _fromCurrency

        &&  exchangeRateCurrencyPair.ToCurrencyCode   == _toCurrency;

        return exchangeRate::findByDate(exchangeRateCurrencyPair.RecId,_transDate).ExchangeRate;

    }

Get a table ID in SQL - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' Regards,