Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / To info itemid ,wareho...
Finance forum
Answered

To info itemid ,warehouse and physical inventory when invent trans update

Posted on by 1,416
 HI ,everyone,
I was trying to info the itemid ,warehouse and physical inventory when invent trans update  , can you please suggest me hou can i get this done i am trying to do it on table post event handler , my code is below , please guide me on this .
 
 
thanks,
Regards,
Dinesh
  • Verified answer
    Dineshkarlekar Profile Picture
    Dineshkarlekar 1,416 on at
    To info itemid ,warehouse and physical inventory when invent trans update
    hi , 
    thanks for reply ,
     
    It was customisation related requirement , so i was trying to info the message for that , i have done the code on post run of inventtrans  and getting desired output .my issue is resolved as of now .
     
     
    thanks,
    Regards,
    Dinesh
  • Andre Arnaud de Calavon Profile Picture
    Andre Arnaud de Cal... 283,377 Super User on at
    To info itemid ,warehouse and physical inventory when invent trans update
    Hi Dinesh,
     
    When coming across this question, I wonder about the business requirement for having an info. What problem are you trying to solve? I don't think it is a valid requirement to have an info message when updating inventtrans records.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 2,526 on at
    To info itemid ,warehouse and physical inventory when invent trans update
    Hi Dinesh,
     
    Do you want to display info message when you update any record in the table?  If yes, try to use COC on the update method you can add something like below:
     
    public void update ()
    {
       next update();
    
      //Your info statement
    }
    Also did you try to trace the code?
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,495 Super User on at
    To info itemid ,warehouse and physical inventory when invent trans update
    when invent trans update
     
    This particular phrase doesn't give any information about the requirement. If you write your code when update of this table, which can happen in multiple ways where the infolog is irrelevant. So, I need complete requirement to resolve this and your code is the not right place.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,416 on at
    To info itemid ,warehouse and physical inventory when invent trans update
    hi thanks for reply,
     
    My code is below please suggest me changes , i have tried the info after the sales order invoiced but the info is not getting done .
    class DTUpdateInventTrans_Eventhandler
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        [PostHandlerFor(tableStr(InventTrans), tableMethodStr(InventTrans, update))]
        public static void InventTrans_Post_update(XppPrePostArgs args)
        {
            InventTrans   inventTrans = args.getThis();
            InventDim     inventDim;
            select InventLocationId from inventDim
                where inventDim.inventDimId ==  inventTrans.inventDimId;
           // != inventTrans.orig().Qty)
            if (inventTrans.Qty)
            {
                info(strFmt("inventTrans.ItemId: %1,inventDim.inventLocationId: %2,inventTrans.Qty: %3,inventTrans.orig().Qty: %4",inventTrans.ItemId,inventDim.inventLocationId,inventTrans.Qty,inventTrans.orig().Qty));
            }
        }
    }
     
  • Layan Jwei Profile Picture
    Layan Jwei 3,081 Super User on at
    To info itemid ,warehouse and physical inventory when invent trans update
    Hi Dinesh,

    your code is empty --- can you at least show us what you tried?
    Also use chain of command instead of event handlers.

    what is your requirement? do you want to print those values each time an update happens, regardless from where?
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,416 on at
    To info itemid ,warehouse and physical inventory when invent trans update
    here is my code 
    class DTUpdateInventTrans_Eventhandler
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        [PostHandlerFor(tableStr(InventTrans), tableMethodStr(InventTrans, update))]
        public static void InventTrans_Post_update(XppPrePostArgs args)
        {
    
        }
    }
    
     

Helpful resources

Quick Links

Upcoming TechTalk: Copilot Capabilities…

Review the Copilot features that are currently available in Dynamics 365 Finance…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,377 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,308 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans