Incorrect form notes in generated XML-file

When a credit note is created for Invoiced sales order, sales Invoice report shows the correct form notes that were setup in Account Receivable setup module( (i.e)Form Notes for Sales credit note ).But when XML file generated for the invoiced sales order credit note the xml file shows form notes for SalesInvoice.
Can anyone help me to resolve the issue??

Can you explain this?

When XML file for the credit note Invoice in sales order is generated in appropriate folder the form notes used is sales invoice instead of sales credit note.
Actually the data should come from credit note (form notes) but by default it fetches sales invoice (form notes).
SalesOrders → Invoiced salesOrder ->Invoice journal → Send Electronically

Looking at the query, it seems that the form letter value has been hard coded.
Look at \Queries\AxdSalesInvoice and the relation between CustInvoiceJour and FormLetterRemarks.

So for both credit note and sales invoice you will get the text from sales Invoice. Looks like a Bug.

Actually they have given the default range as sales invoice in that query.
should i need to dynamically change the range and set as sales credit note??

Report it to Microsoft.
If you want to fix it temporarily, remove the range from query and determine it in the code.
You can determine whether is not a credit note by using, custInvoiceJour.creditNote()

Thank you so much kranthi.
I will fix it through code.
I just dont know where they have actually used the query to retrieve the values for XML file??
Can you please specify where can I need to apply the ranges?

custInvoiceJourLocal.sendElectronically(XMLDocPurpose::Original, AifSendMode::Async);
they have used the method to pass the document type and in sendElectronically() method they have defined the service operation class and in my case it is SalesSalesEinvoice class.
So where is the actual query used and how they are retrieved.I have debugged entire thing and finally it ends in AifOutboundProcessingQueue::submitSendRequest().

Have a look at \Classes\AxdSalesInvoice_Einvoice\initQuery

Kranthi I tried to debug the class AxdSalesInvoice_Einvoice\initQuery but the debugger doesn’t hit in the specific method.
Even I wrote an job to run the batch job that is necessary to send XML file to appropriate folder but the debugger doesn’t hit in the initquery() method.
job to run batchjob

new AIFoutbooundprocessingservice().run()

Batch jobs execute in CIL, therefore you have to use a CIL debugger (= Visual Studio), not the X++ debugger. Did you do it?

Even AxdSalesInvoice_Einvoice\initQuery method should be debugged using CIL debugger??
In my case I just want to debug only this class?

You said you ran a batch job. If it’s true, you have to use the CIL debugger (or run the code in a different way), because batch jobs run in CIL.
If it’s not true, you’ll have to share the correct information with us.

Yeah that’s fine to use CIL debugger for batch jobs.
But I just need to know when the AxdSalesInvoice_Einvoice\initQuery method gets executed?
whether this method gets executed while running a batch job or Just by clicking the send electronically button in sales invoice journal ?
In my case method doesn’t gets executed when I perform the above mentioned process?

Sorry, I don’t remember the whole AX 2012 by heart. I recommend you use cross references to find where methods are used; otherwise you’ll have to wait until I get to an AX 2012 environment or somebody else will help you.
If you want to know what “send electronically” does or doesn’t, why do you simply look into code?

By the way I have mentioned this post in AX2009 and sorry I think you have thought it as 2012 version.

It’s years since I’ve seen such an old version, but the framework is still the same in AX 2012 R3, which I do have somewhere. Unfortunately the framework doesn’t exist anymore in the latest version (which I have installed locally), so I can’t do it for you in the moment.
By the way, learning how to find such information by yourself (e.g. how to use cross references) would greatly help you; you can’t ask in a forum every time when you need to understand a piece of code.

I think i didn’t ask you to explain any code and moreover you didn’t understand the question properly.Question was how debugger hits in Ax2009. So please understand the question and try to reply properly.

My apologies, I thought you said “But I just need to know when the AxdSalesInvoice_Einvoice\initQuery method gets executed?” Now I see it means “how debugger hits in Ax2009”, but unfortunately the sentence doesn’t make sense to me.
It seemed you didn’t know how to debug batches and then you started talking about other things, so now I(n have no idea what you want… Please explain clearly what you need, otherwise there is nothing I can do for you.