Dec 10, 2015

Cross reference update Job for AX objects

static void XRefUpdateBatch(Args _args)
{
    ;
    xRefUpdate::truncateXrefTables();
    xRefUpdateIL::updateAllXref(true, false, true);
    info("Cross reference update batch job created.");
}

Dec 9, 2015

Toggling administrative privileges in AX 2012 R3 through code

static void ToggleAdminMode(Args _args)
{
    ;   
    SecurityUtil::sysAdminMode(!SecurityUtil::sysAdminMode());
    info(strFmt('Admin mode: %1', SecurityUtil::sysAdminMode()));
}

Note :- Once you restart the AX client, your privileges will be restored to normal.

Dec 7, 2015

Generate Xml file for XDS class in AX


static void GenerateXSDSchema_AxdCustTable(Args _args)
{

AxdCustTable    AxdCustTable;
XML             xml;
XMLDocument     xmlDocument;

;
AxdCustTable = AxdBase::newClassId(classnum(AxdCustTable));
xml          = AxdCustTable.getSchema();
xmlDocument  = XMLDocument::newXML(xml);
 
//TODO Select file to write XML output to
xmlDocument.save("D:\\XSDSchema_AxdCustTable.xml");

}