Skip to main content

Notifications

Announcements

No record found.

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

got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

(0) ShareShare
ReportReport
Posted on by

Hi Team,

In AR - Inquiries / Report - Invoice - Invoice Journal - Original Preview

pastedimage1684423276113v1.png

Got the below error

pastedimage1684423354891v2.png

Yesterday, The report was working perfectly but today I don't know why this happened suddenly. I debugged that issue and found

the class "ExchangeRateCalculation"  and method - validateFromCurrency()

The parmFromCurrency is coming NULL 

private void validateFromCurrency()
    {
        if (strlen(this.parmFromCurrency()) == 0)
        {
            // A currency to convert from is required to retrieve exchange rate information.
            this.handleError("@SYS321714", #NoFromCurrencyProvided);
        }
    }

Kindly let me know why the value is coming NULL and how to resolve this. is there any setup issue?

Kindly elaborate pls

Pls give me more shed on this.

thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Thanks Andre for prompt response

    In SalesInvoiceController extension class, I wrote below code

    public static void main(Args _args)
        {      
            
            
            // AR
    
            // The condition is to print Invoice Journal - View - Original Preview or Copy Preview.
            if (_args.record() && _args.dataset() == tableNum(CustInvoiceJour))
            {
            // END
                 
    
                CustInvoiceJour         custInvoiceJour     = _args.record();
            
                CustInvoiceJour_PL      custInvoiceJour_PL  = custInvoiceJour.custInvoiceJour_PL();
                PlFiscalDocState        fiscalStateLoc      = custInvoiceJour_PL.FiscalDocState_PL;
    
                if(fiscalStateLoc != PlFiscalDocState::Changed2Invoice)
                {
                    custInvoiceJour_PL.FiscalDocState_PL        = PlFiscalDocState::Changed2Invoice;
                    custInvoiceJour_PL.AmicisAutoChangedState   = NoYes::Yes;
                    custInvoiceJour.packCustInvoiceJour_PL(custInvoiceJour_PL);
                }
                // NS Developed for 12698 - Printing Original Invoice once with Duplicate functionality by Arpan Sen Date - 17-04-2023
            }  
            // AR
            if (_args.record() && _args.dataset() == tableNum(CustInvoiceDuplicateTable_W))
            {
                _args.parm('CustInvoiceJournal');  // passing caller name
                SalesInvoiceController::custInvoiceDuplicateTable_W  = _args.record().RecId;
                            
            }
            // END
    
            next main(_args);
            
            // AR
            if (_args.record() && _args.dataset() == tableNum(CustInvoiceJour))
            {            
                CustInvoiceJour         custInvoiceJour     = _args.record();
                CustInvoiceJour_PL      custInvoiceJour_PL  = custInvoiceJour.custInvoiceJour_PL();
                // END
                        
                if(custInvoiceJour_PL.AmicisAutoChangedState)
                {
                    custInvoiceJour_PL.FiscalDocState_PL        = PlFiscalDocState::FiscalDocument;
                    custInvoiceJour.packCustInvoiceJour_PL(custInvoiceJour_PL);
                }
                // AR
            } 
            // END      
        }

    Kindly let me know is there any issue in my code pls. what to remove?

    Pls give me more shed on this.

    thanks!

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,187 Super User 2025 Season 1 on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    HI Arpan,

    I would check what happens if you run the reports without your customization. It can be related. Maybe you can set some breakpoints on methods in your custom coding to check if the CustInvoiceJour record is lost or retrieved at all.

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi Mohit & Andre

    Between button Click method & RDP class - Init method, now I am checking Controller class - main method

    Note -  Just now I debugged and continiously watching the value in CustInvoiceJour. Till Clicked method it was fine when it jump to 

    RDP - Init method the _custInvoiceJour RECID got to 0

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi Mohit & Andre,

    This is the below code in SalesInvoicxeOriginal button Clicked method

    which is already there, I have added few code for my requirement.

    [ExtensionOf(formControlStr(CustInvoiceJournal, SalesInvoiceOriginal))]
    final class CustInvoiceJourSalesInvoiceOriginal_Extension
    {
        
        void clicked()
        {
            FormButtonControl   buttonControl       = this as FormButtonControl;
            FormDataSource      custInvoiceJour_ds  = buttonControl.formRun().dataSource(tableStr(CustInvoiceJour));
    
            CustInvoiceJour     custInvoiceJourSelected;
    
            // arpan
            CustParameters      custParameters;
            CustInvoiceJour     custInvoiceJour;
            
            custParameters = CustParameters::find();
            // end
    
            for (custInvoiceJourSelected = getFirstSelection(custInvoiceJour_ds); custInvoiceJourSelected; custInvoiceJourSelected = custInvoiceJour_ds.getNext())
            {
                CustInvoiceJour_PL  custInvoiceJourLoc      = CustInvoiceJour_PL::findByCustInvoiceJour(custInvoiceJourSelected.RecId, true);
    
                if(custInvoiceJourLoc)
                {
                    ttsbegin;
                    custInvoiceJourLoc.AmicisPrintFiscalDoc = AmicisPrintFiscalDoc::FiscalInvoice;
                    custInvoiceJourLoc.doUpdate();
                    ttscommit;
                }
    
                // \Arpan
                if (custParameters.RestrictOrgPreview == NoYes::Yes)
                {
                    ttsbegin;
                    select firstonly forupdate custInvoiceJour
                        where custInvoiceJour.InvoiceId == custInvoiceJourSelected.InvoiceId;
                    
                    if (custInvoiceJour)
                    {
                        custInvoiceJour.OrgPreviewPrint = NoYes::Yes;
                        custInvoiceJour.doUpdate();
                    }                
                    ttscommit;
                }
                // end
            }       
    
            next clicked();
        }
    
    }

    I believe , when user clicked OK on salesInvoiceOriginal (OriginalPreview) button then it called first custom code and then standard code.

    after this, is it go to directly init method of SalesInvoiceDP class?  I debugged it but not found the exact result.

    Kindly let me know where it goes after click on the button, becuase in init method, as mentioned on the thread the custInvoiceJour retrun RECID = 0 and becuase of this we got faced that error

    please help me

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi Andre & Mohit

    I lot of debuuged the code and found

    Class - SalesInvoiceDP  -- > Init method

    /// 
        /// Initializes required data before it starts to process the report.
        /// 
        /// 
        /// A CustInvoiceJour record that has the sales invoice header information.
        /// 
        /// 
        /// This method will initialize some variables which will be used during processing the report.
        /// 
        protected void init(CustInvoiceJour _custInvoiceJour)
        {
            super(_custInvoiceJour);
    
            if (_custInvoiceJour.creditNote())
            {
                isInvoiceCreditNote = true;
                formLetterRemarks = FormLetterRemarks::find(_custInvoiceJour.salesTable().LanguageId, FormTextType::SalesCreditNote);
            }
            else
            {
                formLetterRemarks = FormLetterRemarks::find(_custInvoiceJour.salesTable().LanguageId, FormTextType::SalesInvoice);
            }

    the CustInvoiceJour RECID is showing 0

    super(_custInvoiceJour); 


    Class - SalesInvoiceDPBase

    protected void init(CustInvoiceJour _custInvoiceJour)
    {
        cachedExchRate = this.getAccountingExchangeRate(_custInvoiceJour);
    }

    Got the error cachedExchRate here.

    Kindly hints me pls where ( I mean in which method) can I check why custInvoiceJour recid is getting 0 ?

    pls give me more shed on this.

    thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi Andre,

    As I told you the fromCurrency is showing blank value

    So, I checked the GL - Ledger setup - Ledger

    pastedimage1684481334441v1.png

    From currency is already mentioned.and the date is April 23 to June 23

    The invoice which i Run , the invoice date is 12-17-2022.

    pastedimage1684481557536v2.png

    is it the issue, I am getting this error?

    Pls give me more shed on this.

    thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi Andre, Mohit

    Kindly guide me for the source of the parm value pls

  • @rp@n Profile Picture
    @rp@n on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Yes Andre, not only the particular invoice. I have checked with 3-4 invoices, all have the same issues. But before all are working perfectly without issue.

    I have done few custamuzation on report only. And did code in DP class.I have checked those last week. Functional is tested on my environment only. Worked absolutely fine. Then I checked last week and they deployed on SIT environment on yesterday.

    They said, the some issue happened in SIT. So, I thought there is some issue on SIT olny but later on I think to test in my DEV machine. So, found here is also same issue.

    I not understand why this is happened suddenly?

    In other DEV machine,  I checked with debug , this.parmfromCurrency showing the currency PLN and report is generated without any issues.

    Is this is happened becuse of my code?

    My custamuzation is only need to add text in header.

    Is any setup missing?

    Kindly elaborate please.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi, Check this old thread, it's pointing to an article which says to clear usage data. Maybe it help you.

    community.dynamics.com/.../error-a-currency-to-convert-from-is-required-to-retrieve-exchange-rate-information-in-payment-journal

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,187 Super User 2025 Season 1 on at
    RE: got error Currency to convert from is required to retrieve exchange rate information in Invoice Journal - Original preview report

    Hi Arpan,

    Is exactly the same invoice giving the error which worked correctly yesterday? Did something change on this environment?

    We can't know what exact data you have in your environment. You can better continue debugging and check some methods which will run before the method ExchangeRateCalculation::validateFromCurrency to check the source for this parm value.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans