X++ Code to Post Sales Order Invoice line by line - D365 F&O || AX 2012

Hello Everyone,

Today we will be looking at how to invoice a Sales order line by line. We usually use "SalesFormLetter" class and "run" method to post and SO which will post the entire SO and all the lines in it. Recently I have come across a new requirement while posting an SO i.e.., to post the SO invoice line by line. So lets see how the code is build.


Public static void salesOrderInvoiceByLine(SalesLine    _salesline)
{
        salesFormLetter         salesFormLetter;
        salesFormletterParmData salesFormLetterParmData;
        salesParmUpdate         salesParmUpdate;
        salesParmTable          salesParmTable;
        salesParmLine           salesParmLine;
        salesTable              salesTable;
      
        ttsbegin;
        salesTable  = salesTable::find(_salesline.SalesId);
        salesFormLetterParmData = salesFormletterParmData::newData(DocumentStatus::Invoice, VersioningUpdateType::Initial);

        salesFormLetterParmData.parmOnlyCreateParmUpdate(true);
        salesFormLetterParmData.createData(false);
        salesParmUpdate = salesFormLetterParmData.parmParmUpdate();

        salesParmTable.clear();
        salesParmTable.TransDate                = _salesline.ReceiptDateRequested;
        salesParmTable.Ordering                 = DocumentStatus::Invoice;
        salesParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
        salesParmTable.salesId                  = salesTable.salesId;

X++ Code to get Address Lookup Based On Purpose D365 FO || Ax2012

Hello everyone, 

In our day to day life we(Developers) always come across address requirements very frequently, so today's post is related to it.  

Fetching customer/Vendor address based on purpose.

public static void customerInvoiceAddresslookup(FormStringControl   _control,
                                                                                  DirPartyRecId          _party)
{
    query                                    query;
    QueryBuildDataSource        qbds;
    SysTableLookup                   sysTableLookup;
    LogisticsPostalAddress        address = null;
    DirPartyLocation                   partyLocation;
    DirPartyLocationRole            partyLocationRole;
    LogisticsLocationRole           locationRole;

    query   = new Query();
    sysTableLookup = SysTableLookup::newParameters(tableNum(LogisticsPostalAddress), _control);

AX 2012 Development Introduction

These materials are very helpful to the beginners.

Click Here To Download

DIXF:"Entity name must be filled in" In Ax 2012 R3 CU8, CU9, CU 10

Hi Friends, today while I was working on DIXF framework, I faced this warning message (Which is not allowing me to perform any other operations) "Entity name must be filled in".


This Issue has occurred in AX 2012 R3 CU8 version(for myself). I also found that when ever we upgrade to any higher version of AX 2012 like CU9, CU10 we will encounter with this same warning.

Solution to this issue can be done in two ways,

Important Note:
1st workaround will be helpful for the people who are working on AX 2012 R3 CU9, CU10.
2nd workaround will be helpful for the people who are working on AX 2012 R3 CU8 or any  older versions.