Alfasith AX

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

Thursday, August 20, 2015

X++ code to validate & post invent Journal in AX 2012

Hi,

static void AlfasithPostJournal(Args _args)
{ 
    InventJournalCheckPost      inventJournalCheckPost;
    InventJournalTable          inventJournalTable;
    ; 
    inventJournalTable = InventJournalTable::find("INV-0001245");
    inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckPostType::Check, inventJournalTable);
    inventJournalCheckPost.parmThrowCheckFailed(true);
 // This true enable to prompt the error msg validate the journal
    try
    { 
        inventJournalCheckPost.run();
    }
    catch
    {
        info("The journal contains errors.");
    }
}
*************************************OR****************************************
static void AlfasithPostJournal(Args _args)
{ 
    InventJournalCheckPost      inventJournalCheckPost;
    InventJournalTable          journalTable;
    ; 
    journalTable= InventJournalTable::find("INV-0001245");
if(InventJournalCheckPost::newPostJournal(journalTable).validate()) InventJournalCheckPost::newPostJournal(journalTable).run();   
}

Regards,

Thursday, August 13, 2015

Creating a views in AX

Hi,

Create views 

  • Create new view
  • Metadata node, right-click on the Data Sources node and select new data source.
  • Change table property to the table name (parent).
  • In the ds of parent table create another ds and select table property as child table.
  • In the child table ds select yes to relation property.
  • Observe If you expand the Relations node you will find auto populated relation.

Regards,

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...