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, ...
Answered

insert data in table after inserted record in salestable

(0) ShareShare
ReportReport
Posted on by 383

Hello every one ,

i need to insert a data in customized table after the record created in sales table

I have the same question (0)
  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Hi Ahmed,

    are you working with AX (2012 or older) or D365 Finance & Supply Chain Management?

  • AhmedSaeed Profile Picture
    383 on at

    i'm working with D365 F&O

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

    Moved to D365 Finance forum.

    You can use Chain of Command to run your logic after insert() method of SalesTable has been called.

    docs.microsoft.com/.../method-wrapping-coc

  • AhmedSaeed Profile Picture
    383 on at

    Hi Nikolaos,

    i'm trying to do it in COC but if the record not created it also will do the action

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

    Hi Ahmed,

    I don't understand your description. May I suggest that you share as much information as possible, so that we have better chance of helping you? For example, if you have some problems with your code, you have to remember that people who can see the code have much better chance of spotting possible issues in it.

    In addition to this, I would like to ask you to debug your code to understand what it does.

    Thanks!

  • AhmedSaeed Profile Picture
    383 on at

    Hi Nikolaos,

    Thanks for your replay the below is a sample from my code , i just need to take an action after the record inserted

    [ExtensionOf(tablestr(WMSPickingRoute))]

    final class WMSPickingRoute_Extension

    {

       void insert()

       {

           next insert();

           Info("Inserted");

       }

    }

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

    Hi,

    thanks for sharing your code.

    It looks like you have implemented it in wrong table (WMSPickingRoute) - your requirement was to hook in insert of SalesTable. Additionally, please remember to use your prefix in the class name to avoid naming conflicts.

    But in general it looks good - it will run your code whenever a record is inserted in the related table (WMSPickingRoute).

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Just add a condition

    if(this.recID)
        info(inserted);

  • AhmedSaeed Profile Picture
    383 on at

    Hi Nikolaos,

    yes it's a different table i need to add action it also , but when use the above code it also execute the info code even if the record didn't created  

  • Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    When does it happen that insert() completes successfully (without throwing an exception) but it doesn't create a record? It sounds like a violation of contract to me.

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 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans