AX 中識別被破壞的表對象 Identifying damaged Table objects in the AOT MetaData

來源:互聯網
上載者:User
Identifying damaged Table objects in the AOT MetaData

 

It happens very seldom, but sometimes the AOT MetaData is getting damaged, especially for Table objects.

Indications of such an element “corruption” can be that you have one explicit Table in the AOT and every time you access this object either the Dynamics AX Client or the Dynamics AX Application Object Server crashes. But the issue can also start earlier when you expand the Data Dictionary node of the AOT.

If you have no idea what Table could be affected the following X++ Job can help you finding out, by walking through the UtilIdElements Table touching each individual Table object:

static void findDamagedTableObjects(Args _args)
{
    UtilIdElements util;
    common tabBuff;
    DictTable dt;
    ;

    //Look at all Tables
    while select util where util.recordType == utilElementType::Table
    {
        /* Print out the name; the last element showing up here is
           most likely the object causing issues... */
        print strFmt('Layer: %1 | Table Id: %2 | Table Name: %3',
           util.utilLevel, util.id, util.name);

        //This will eventually cause the Client or AOS to crash
        dt = new DictTable(tablename2id(util.name));
        tabBuff = dt.makeRecord();
    }

    print 'Completed without error!';
    pause;
}

The Job accesses all Table Objects and lists them in the Print window. When the damaged element is reached the operation is stopped (e. g. because the AOS is crashing) so the last object showing up in the Print window is most likely the one causing the trouble.

Once you know the Table object causing issues, you could try deleting the object programmatically with the following X++ Job:

static void deleteDamagedTableObject(Args _args)
{
    UtilIdElements utilElement;
    UtilElementName tableName;
    UtilEntryLevel tableLayer;
    ;
   
    /********************************************************************/
    /* Please adjust to the Table Name and Table's Layer to be removed! */
       tableName = 'NameOfDamagedTableToBeRemoved';
       tableLayer = utilEntryLevel::usr;
    /********************************************************************/
   
    ttsbegin;
    select utilElement where utilElement.name == tableName
       && utilElement.utilLevel == tableLayer
       && utilElement.recordType == utilElementType::Table;
   
    if (utilElement)
    {
        utilElement.delete();
        ttscommit;
   
        info(strFmt('Table object %1 in Layer %2 has been deleted!', tableName, tableLayer));
    }
    else
    {
        ttsAbort;
   
        warning(strFmt('Table object %1 in Layer %2 was not found!', tableName, tableLayer));
    }
}

If attempting to delete the Table object with the previous X++ Job fails in any way, it will be necessary to rebuild the layer the damaged object is existing.

One possibility to rebuild a damaged layer is:

  1. Create a new Project in the AOT
  2. Specify a filter for all elements from the affected layer (don't use any grouping here, as this could again cause a crash)
  3. Create another new Project and manually move all non-damaged objects from the first Project to the the other
  4. Export the second Project as XPO (with IDs)
  5. Stop the AOS and delete the damaged Layer’s AOD file (and AOI)
  6. Start the AOS again
  7. Re-import the XPO to the same Layer (now the corrupt object is gone)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.