web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Need to update Inventory dimension in Transfer Journal lines from Transfer Journal header

(0) ShareShare
ReportReport
Posted on by 282

Hi All,

My scenario is while creating a new record in Transfer Journal Lines , Inventory Dimension need to update from Transfer Journal header in Dynamics 365.

I tried with Create event of data source and Inserting event of table...Also i tried to creating new field in lines and in modified method i have created Dimension from header combination and passed it to Lines Inventdimid, but not succeed.Got below error:-

Error:- Inventory dimension Site is mandatory and must consequently be specified. Update has been canceled.

If any one have idea please let me know.

Regards,

Amol

 

I have the same question (0)
  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    Does journal header has site specified ? If not, you have to create / search new inventtdim including site and then assign it.

  • Suggested answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    Hi Amol,

    Here is what's going on:

    1. You assigned the inventSite/Warehouse on the journal header and then created line.

    2. What happens is the dimension (InventDimId) gets defaulted from journal header.

    3. However if you go to lines, you will see that you need to specific the inventSite /Warehouse twice.

    Why - because the transfer journal helps transfer goods from one site/warehouse.... to other site/warehouse.... reason for using dots is because there are other dimensions as well.

    4. What you are missing is the 'To site/warehouse' fields on the user interface. In the backend, it's called "ToInventDimId". so initialize the value in this field and then save the InventJournalTrans field.

    once you do this, you will not receive the error. Hope this helps.

  • AX.. Profile Picture
    20 on at

    Hi Satish,

    Thanks for reply.

    I have created two inventdim i.e one for Inventdimid and second for Toinventdimid from Journal header site , warehouse.

    But facing same issue.

    Regards,

    Amol

  • AX.. Profile Picture
    20 on at

    Hi Sukrut ,

    From Inventory Transfer header (site,Warehouse) i am creating inventdim and ToInventdimID and passing to field inventdimid in lines.

    I am writing this code in modified event handler of Item Name (Customized field in  Inventory Transfer Lines ).

    But not succeed, getting below error.

    pastedimage1576842684696v1.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Would it be possible to see your code? As always, seeing the code helps a lot when trying to find what could be wrong with it.

    In your screenshot we see that the To warehouse and To site are not specified.

  • AX.. Profile Picture
    20 on at

    Below is my code:-

    /// <summary>

       ///

       /// </summary>

       /// <param name="sender"></param>

       /// <param name="e"></param>

       [FormDataFieldEventHandler(formDataFieldStr(InventJournalTransfer, InventJournalTrans, ItemName), FormDataFieldEventType::Modified)]

       public static void ItemName_OnModified(FormDataObject sender, FormDataFieldEventArgs e)

       {

           FormDataSource          InventJournalTrans_ds  = sender.datasource();

           FormRun                 formRun                = sender.datasource().formRun();

           //FORMRUN

           InventJournalTrans          InventJournalTrans,InventJournalTransupdate;

           InventJournalTable          InventJournalTable;

           InventTableExpanded         inventTableExpanded;

           InventTable                 table;

           InventDim                   fromInventDim,ToinventDim;

           str                         ItemName;

           InventJournalTrans      = InventJournalTrans_ds.cursor();

           ItemName                = InventJournalTrans.ItemName;

           InventJournalTable      = InventJournalTable::find(InventJournalTrans.JournalId);

           select inventTableExpanded

                       where inventTableExpanded.ProductName == ItemName

                       &&    inventTableExpanded.DataAreaId == curExt();

           {

               InventJournalTrans.ItemId    = inventTableExpanded.ItemId;

               InventJournalTrans.ItemGroup = InventItemGroupItem::itemGroupByItemIdLegalEntity(InventJournalTrans.ItemId, InventJournalTrans.DataAreaId).ItemGroupId;

               select firstonly table where  table.ItemId == InventJournalTrans.ItemId;

               InventJournalTrans.initFromInventTable(table);            

               ttsbegin;

               fromInventDim.clear();

               fromInventDim.InventSiteId     = InventJournalTable.InventSiteId;

               fromInventDim.InventLocationId = InventJournalTable.InventLocationId;

               fromInventDim.wMSLocationId    = InventJournalTable.wMSLocationId;

               ToinventDim.clear();

               ToinventDim.InventSiteId       = InventJournalTable.InventSiteId;

               ToinventDim.InventLocationId   = InventJournalTable.InventLocationId;

               ToinventDim.wMSLocationId      = InventJournalTable.wMSLocationId;

               InventJournalTrans.InventDimId   = InventDim::findOrCreate(fromInventDim).inventDimId;

               InventJournalTrans.ToInventDimId = InventDim::findOrCreate(ToinventDim).inventDimId;

               ttscommit;

           }

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    It seems that you want to have same values in From/To Site and Warehouse. Why? Aren't you supposed to transfer from place A to place B? What is your functional requirement?

    Anyway you should call inventJournalTrans.update() if you want to save the values in the table.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,955 Super User 2025 Season 2 on at

    Hi,

    I don't think it makes sense to augment the ItemName field here. Or do you modify the product name on each line? Try to have a data event on the Item ID field or when you initialize the record.

  • AX.. Profile Picture
    20 on at

    Hi Nikolaos,

    Requirement is need to update Inventory Dimension (from site, from warehouse, To site , To warehouse)  in Inventory Transfer Lines from Inventory Transfer header while creating a new record in lines or when we select an Item or item name in lines.

    Below is the screenshot for the same.

    1. Inventory Transfer Journal Header :- (To Site , To Wh, To Loc Customised field)

    pastedimage1576849556076v2.png

    2. Need to Update below Inventory Dimension from Header while creating a new record or Selection of Item Name.

    pastedimage1576849783004v3.png

    Please let me know if you have any idea about the same.

    Regards,

    Amol

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Your current code is not using these customized fields, perhaps that explains why you don't get values from the customized fields to the lines.

    Also hooking to ItemName.modified doesn't seem to make much sense. Perhaps your code is never even executed because of this. Did you debug it and check if your code is executed? I think you should hook in inventJournalTrans.initFromInventJournalTable method since that method is used to initialize line information from the header.

    You can check how the inventDim is handled in that method, and use that as inspiration for handling your own "to inventdim" fields.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 291 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans