Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How to create an Item Cross Reference using web services

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I want to create a Bar_Code Item Cross Reference but I got an error that I'm not been able to solve.

This is how I do it.

- Create an entry en Page 5723 "Item Cross References" like:

<ItemCrossReferences>
    <Key>...</Key>
    <Cross_Reference_No>XXXXXX</Cross_Reference_No>
    <Item_No>8011</Item_No>
    <Unit_of_Measure>EACH</Unit_of_Measure>
    <Discontinue_Bar_Code>false</Discontinue_Bar_Code>
</ItemCrossReferences>

This works great.

Now the failing part

- Create an entry in the Page 5721 "Item Cross Reference Entries".

<ItemCrossReference>
    <Key>...</Key>
    <Cross_Reference_Type>Bar_Code</Cross_Reference_Type>
    <Cross_Reference_No>XXXXXX</Cross_Reference_No>
    <Unit_of_Measure>EACH</Unit_of_Measure>
    <Discontinue_Bar_Code>false</Discontinue_Bar_Code>
</ItemCrossReference>

And then I get this error:
System.Web.Services.Protocols.SoapException: 'The Item does not exist. Identification fields and values: No.='''


Any idea of what might be the problem?

I do not see any No. property in the ItemCrossReference class

Thanks,
Ignacio

*This post is locked for comments

  • Suggested answer
    Andrey Baludin Profile Picture
    Andrey Baludin 3,941 on at
    RE: How to create an Item Cross Reference using web services

    Think about 5721 and 5723 as a 2 interfaces for the same table. Then you create record in 5723 it appears in Item Cross Reference table and you can't create it with 5721 because it already exists (same key). You just need to create it with one of them. not in both.

    But it's very strange that you can't see it in 5721. It definitely exists there.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to create an Item Cross Reference using web services

    Hi,

    I have now another issue, as I said I'm creating both a record in both 5721 & 5723 pages. I can create the record in 5723 but when I try it in 5721 I'm getting this error:

    The Item Cross Reference already exists. Identification fields and values: Item No.='1006',Variant Code='',Unit of Measure='EACH',Cross-Reference Type=' ',Cross-Reference Type No.='',Cross-Reference No.='XXXXXX1111''

    You pointed that both 5721 & 5723 use the same underlying table.

    Do I need to create both entries?

    I know I'm missing something, because after I create the record in 5723 I can see it when querying the web service, but I do not see the entry in 5721

    What I'm missing?

    Thanks,

    Ignacio

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to create an Item Cross Reference using web services

    Thanks for your help,

    Note for future searches:

    This is how you design a page in NAV

    stoneridgesoftware.com/dynamics-nav-development-for-non-developers-part-6-adding-a-field-to-a-list-page

  • Verified answer
    Andrey Baludin Profile Picture
    Andrey Baludin 3,941 on at
    RE: How to create an Item Cross Reference using web services

    You need to add Item No field on page 5721 at NAV to see it in Web Service.

    But pages 5721 and 5723 are both based on the same table - Item Cross Reference. Why do you need them both as web services? You can use just 5723 and everything will be ok.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to create an Item Cross Reference using web services

    Hi Andrew,

    Thanks for  your answer, unfortunately I cannot see the Item_No field in the schema provided by the web service. This is the description of the ItemCrossReference returned by that page (5721 "Item Cross Reference Entries")

    <xsd:sequence>
    <xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Cross_Reference_Type" type="tns:Cross_Reference_Type"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Cross_Reference_Type_No" type="xsd:string"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Cross_Reference_No" type="xsd:string"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Variant_Code" type="xsd:string"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Unit_of_Measure" type="xsd:string"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Description" type="xsd:string"/>
    <xsd:element minOccurs="0" maxOccurs="1" name="Discontinue_Bar_Code" type="xsd:boolean"/>
    </xsd:sequence>
    Thanks,
    Ignacio
  • Suggested answer
    Andrey Baludin Profile Picture
    Andrey Baludin 3,941 on at
    RE: How to create an Item Cross Reference using web services

    Hi! You have to pass Item No. for which you create item cross-reference. On Insert trigger has Item.GET() function which throws you an exception:

    crossref.JPG

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans