Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Modify table after Insert in other table

Posted on by Microsoft Employee

Hi experts,

i work on Dynamics NAV 2009 R2, I have created a specific table "50007" that contains those fields "Resposible Id","Date" and "Asset N°." . And i created a form for this table.

Now i want to modify ( "Fixed Asset table" 5600 ) When i will add a new row in 50007 Table. i want modify Asset Asset No  for Responsible.

 

 

thnx

*This post is locked for comments

  • Verified answer
    mmv Profile Picture
    mmv 11,465 on at
    RE: Modify table after Insert in other table

    Hi Tharanga,

    As the Asset "No." is the Primary Key in the Fixed Asset table, perhaps the below code would be the best way:-

    IF recFA.GET("Asset No.") THEN BEGIN // This will filter the Fixed Asset master to your

      recFA.Responsible := "Resposible Id";  // assign the responsible person.

      recFA.MODIFY;  // finally modify the FA master table

    END;

    Best Regards,

    MMV

  • Verified answer
    TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Modify table after Insert in other table

    As Suresh said I believe table primary key is the Responsible ID and that means one person can only responsible for a one Asset.

    Let me go to the coding.

    In the new table you need to define a record variable for the Fixed Asset (Data Type : Record)

    Open the table in the design view and then go to Global Variables and then provide a name (recFA) for the variable and select the variable type as Record. Then from the SubType you need to select the Table Fixed Asset.

    After that process is completed you need to go to the code level by pressing F9 key. Then go to the OnValidate trigger of the "Asset No." and write the below code.

    recFA.RESET;
    recFA.SETFILTER(recFA."No.","Asset No."); // This will filter the Fixed Asset master to your record variable.
    IF recFA.FINDFIRST THEN BEGIN
       recFA.Responsible := "Resposible Id";  // assign the responsible person.
       recFA.MODIFY;  // finally modify the FA master table
    END;

    This code will get executed every time you do any modification to Asset N° column in your new table.

  • mmv Profile Picture
    mmv 11,465 on at
    RE: Modify table after Insert in other table

    hi InfoT,

    As mentioned by Suresh, you may add the code in the "Asset No." OnValidate trigger.  But you never mentioned as to what you want to modify on the Fixed Asset.

    Best Regards,

    MMV

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Modify table after Insert in other table

    Hello, I believe in your new table Responsible ID is the key, so what you can do is add the code on the validate of Asset No. field in 50007 to get the Fixed Asset Record using GET statement and modify it.

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans