Update field in InventTable using Excel Add In

  • Update field in InventTable using Excel Add In

    Posted by Amy Axness on April 23, 2017 at 8:18 am
    • Amy Axness

      Member

      April 23, 2017 at 8:18 AM

      I am trying to update a custom field in the InventTable in AX 2012 R2 CU6 using the Excel Add In and I am getting the following error message.Ā 

      Cannot create a record in Items – storage dimension groups (EcoResStorageDimensionGroupItem). Item number: 2300CW2, ST-WH-LOC. The record already exists. Document Generic document could not be updated. Error details: Cannot create a record in Items – storage dimension groups (EcoResStorageDimensionGroupItem). Item number: 2300CW2, ST-WH-LOC. The record already exists.

      The process I used was – Add Data -> Add Tables -> InventTable.Ā  The item number and product.product number fields are mandatory, then IĀ added the UPC Code (our custom field).Ā  I clicked refresh to retrieve the values in AX.Ā  ThenĀ I updated the UPC Codes for the ones that were missing and clicked publish.

      HasĀ anyone else run into this?Ā  I am not trying to create anĀ item,Ā just update it.Ā  Any suggestions?

      ——————————
      Amy Axness
      Controller
      J&D Manufacturing
      Eau Claire WI
      ——————————

    • Scott Morley

      Member

      April 23, 2017 at 3:02 PM

      Amy,
      I ran into this about a year ago. The issue is with the AXInventTable class. When an update happens it calls an insert of the DimensionGroupItem without checking if an existing record is there first. Below is the code I used to fix it. I did some testing of it, but the customer was hesitant to change the dimension code so it was never implemented, so I can’t share long term effects.Ā 

      In Classes -> AXInventTable -> write I added two IF statements to skip the Dimension group write if it exists:Ā 

      // storage dimension group is optional; only write if it is set
      if ( axEcoResStorageDimensionGroupItem.parmStorageDimensionGroup() != 0
      && axEcoResStorageDimensionGroupItem.parmItemId())
      {
      //S Morley – if default dimension exists, the write will fail. Validate the record does not exist first
      if (!EcoResStorageDimensionGroupItem::findByItem(axEcoResStorageDimensionGroupItem.parmItemDataAreaId(), axEcoResStorageDimensionGroupItem.parmItemId()).RecId)
      axEcoResStorageDimensionGroupItem.write();
      }

      // tracking dimension group is optional; only write if it is set
      if ( axEcoResTrackingDimensionGroupItem.parmTrackingDimensionGroup() != 0
      && axEcoResTrackingDimensionGroupItem.parmItemId())
      {
      //S Morley – if default dimension exists, the write will fail. Validate the record does not exist first
      if (!EcoResTrackingDimensionGroupItem::findByItem(axEcoResTrackingDimensionGroupItem.parmItemDataAreaId(), axEcoResTrackingDimensionGroupItem.parmItemId()).RecId)
      axEcoResTrackingDimensionGroupItem.write();
      }

      ——————————
      Scott Morley
      Principal Application Architect
      OneNeck IT Solutions
      Bend OR
      ——————————
      ——————————————-

    • Colby Gallagher

      Member

      April 23, 2017 at 11:22 PM

      I’ve run into this before a few times.Ā  Your storage and / or tracking dimension groups are defined at the product level in addition to the released product level.Ā  You only need them at the released product level unlessĀ for some reason you want to force all companies in your instance of AX to have the same storage / tracking dims for a given product. Delete the storage / tracking dimensions at the product level and you will be able to update InventTable via the add-in.Ā Ā Ā  You can do the delete in either the client or via the add-in.Ā  Ā 

      Reminder, do this in a sandbox or on one Product # first please.

      ——————————
      Colby Gallagher
      Manufacturing Systems Consultant
      Agility Business Solutions
      Brecksville OH
      ——————————
      ——————————————-

    Amy Axness replied 8 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Update field in InventTable using Excel Add In’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!