Saturday, 30 November 2019

Add new Document Type for Print management under Accounts Receivable

Extend Enum PrintMgmtDocumentType  and add new enum : SORouting
Extend Enum PrintMgmtNodeTypeand add new enum  :SORouting

Add new Document Type : 


[ExtensionOf(Classstr(PrintMgmtNode_Sales))]
final  class CITPrintMgmtNode_Sales_Extension
{
    public List getDocumentTypes()
    {
        List docTypes;

        docTypes = new List(Types::Enum);
        docTypes = next getDocumentTypes();
        docTypes.addEnd(PrintMgmtDocumentType::SORouting);
        return docTypes;
    }

}
PrintMgmtDocumentType.CITExtension
====================================================================
[ExtensionOf(classStr(PrintMgmtReportFormatPopulator))]
public final class CITPrintMgmtReportFormatPopulator_Extension
{
    //LogisticsAddressCountryRegionISOCode isoCountryCode;
    //LogisticsAddressCountryRegionId countryRegionId;
    #ISOCountryRegionCodes
    #PrintMgmtSetup
 

    protected void addDocuments()
    {
        next addDocuments();
        // this.add(PrintMgmtDocumentType::SORouting);
        this.addOther(PrintMgmtDocumentType::CITSORouting, ssrsReportStr(CITSalesConfirm, SORouting), ssrsReportStr(CITSalesConfirm, SORouting), #NoCountryRegionId);
     
    }
}
====================================================================


Wednesday, 6 November 2019

Dealing with the “The natural key for the table was not found” error in the Dynamics 365 Data Entity Wizard

https://stoneridgesoftware.com/dealing-with-the-the-natural-key-for-the-table-was-not-found-error-in-the-dynamics-365-data-entity-wizard/

https://ztirom.at/2017/05/ax7-fix-natural-key-not-found-when-creating-a-data-entity/

Sunday, 3 November 2019

Runnable class to set current fiscal year to Calendar Field in Asset book

class SetCalendarToFixedAssetBooks
{
    public static void main(Args _args)
    {
        AssetBookTable assetBookTable1,assetBookTable2;
        AssetBookId book1,book2;
        book1='AMT';
        book2='FED';
       
        RecId FiscalYearRecId = Ledger::FiscalCalendar();
        if(Box::okCancel('Set current Fiscal Year to Asset Books with BookIds- AMT & FED ?',DialogButton::Cancel) == DialogButton::Ok)
        {
            ttsbegin;

            select  forupdate assetBookTable1 where assetBookTable1.BookId == book1;
            select  forupdate assetBookTable2 where assetBookTable2.BookId == book2;


            if(assetBookTable1)
            {
                assetBookTable1.FiscalCalendar = FiscalYearRecId;
                assetBookTable1.update();
                info(strFmt("Calendar set for AssetBook with BookId %1", book1));
            }

           
            if(assetBookTable2)
            {
                assetBookTable2.FiscalCalendar = FiscalYearRecId;
                assetBookTable2.update();
                info(strFmt("Calendar set for AssetBook with BookId %1", book2));
            }
            ttscommit;
        }
    }

}