Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

(0) ShareShare
ReportReport
Posted on by 120

Trying to show the OMOperatingUnit lookup based on the selected  hierarchy.
Created a query and that query fetched values are showing in the lookup.
But after seleceting the values. getting the below error

Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

Stack trace

(C)\Classes\SysLookupMultiSelectGrid\getSelected - line 34
(C)\Classes\SysLookupMultiSelectGrid\run - line 38
(C)\Classes\SysLookupMultiSelectGrid\lookup - line 10
(C)\Classes\SysLookupMultiSelectCtrl\ctrlNames_lookup - line 3

*This post is locked for comments

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,820 Super User 2024 Season 2 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    Hi Suresh,

    If you still need help, you can better create a new question with some background details on the forum. You are responding on an old; already completed question.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    How to solve this problem?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    error executing code: the field with id '0' does not exist in table 'smaserviceorderline'. stack trace (c)\data dictionary\maps\smaservicelinemap\methods\fieldmodifiedcategoryid - line 30 (c)\data dictionary\tables\smaserviceorderline\methods\modifiedfield - line 22 (c)\classes\formdataobject\modified (c)\forms\smaserviceordertable\data sources\smaserviceorderline\fields\projcategoryid\methods\modified - line 3 (c)\classes\formstringcontrol\modified

  • Verified answer
    ndakota033 Profile Picture
    ndakota033 120 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    Hello Ievgen and Andre,

    Its working fine now.

    I have changed 3 things.

    1. Swap the datasource

    2. make the 2nd datasource dynamic property to No

    3. Delete the orgUnitQuery.clearAllFields();

    Now the code looks like

    MyTable orgHierarchyTypeParameter;
    QueryBuildDataSource qbdsOMHierarchyRelationship,qdbsOperatingUnit;
    Query orgUnitQuery = new Query();

    select firstOnly Myfield from orgHierarchyTypeParameter;

    qdbsOperatingUnit = orgUnitQuery.addDataSource(tableNum(OMOperatingUnit));

    qdbsOperatingUnit.fields().clearFieldList();

    qdbsOperatingUnit.fields().addField(fieldNum(OMOperatingUnit,OMOperatingUnitNumber));
    qdbsOperatingUnit.fields().addField(fieldNum(OMOperatingUnit,Name));
    qdbsOperatingUnit.addOrderByField(fieldNum(OMOperatingUnit,OMOperatingUnitNumber));

    qbdsOMHierarchyRelationship = qdbsOperatingUnit.addDataSource(tableNum(OMHierarchyRelationship));

    qbdsOMHierarchyRelationship.addRange(fieldNum(OMHierarchyRelationship, HierarchyType)).value(strFmt('%1',orgHierarchyTypeParameter.MyField));
    qbdsOMHierarchyRelationship.fields().dynamic(NoYes::No);
    qbdsOMHierarchyRelationship.fields().clearFieldList();

    msCtrlOrgUnit = SysLookupMultiSelectCtrl::constructWithQuery(element, MyControlName, orgUnitQuery);

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    Did you swap your data sources ?

  • ndakota033 Profile Picture
    ndakota033 120 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    No.

    Its working now but I am able to see all the fields value in the lookup.

    which I dont want  :(

    lastParameter is not working . I have already tried

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,820 Super User 2024 Season 2 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    Assuming you would like to have the operating unit as lookup field, I would also swap the data sources and use the OMHierarchyRelationship only for filtering purpose.

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    can you swap your data sources ?

    If you will make OMOperatingUnitNumber first one and will join OMHierarchyRelationship to it everything would be ok as well.

  • ndakota033 Profile Picture
    ndakota033 120 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    Yes Its working after commenting that line.

  • ndakota033 Profile Picture
    ndakota033 120 on at
    RE: Error executing code: The field with ID '0' does not exist in table 'OMHierarchyRelationship'.

    Hi,

    If I delete that line , in dropdown it is showing all the fields from the table.

    Thats why I have wrote orgUnitQuery.clearAllFields();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans