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 :
Microsoft Dynamics NAV (Archived)

Inserting From a page to a table

(0) ShareShare
ReportReport
Posted on by

Hi everyone, am trying to insert a candidate info to my employee table when the status is changed to hired but it is not inserting the new record. I put the codes on page action but i don't know why is not working. 


IF Status = Status :: Hired THEN BEGIN
Employee.INIT;
Employee."No." := 'PC037';
Employee."First Name" := "First Name";
Employee."Middle Name" := "Middle Name";
Employee."Last Name" := "Last Name";
Employee."Job Title" := "Job Title";

Employee.INSERT;
END
ELSE BEGIN
MESSAGE('THIS IS NOT INSERTING');
END;

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Do the pointer comes inside of your IF condition?

    Please do start the debugger and have a debug point at the very fist line of your code and start the debugging.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Another method would be have another message box inside your IF condition and check the pointer really comes inside your condition.

  • Community Member Profile Picture
    on at

    I have a message in the IF condition but it is not executing.

  • Community Member Profile Picture
    on at

    Hi SeyMalick,

    I think you should change your insert line like this

    IF NOT Employee.INSERT THEN

    MESSAGE('THIS IS NOT INSERTING');

    and you don't need the else begin...

    So your message would popup if your insert was not successful, that would give you a better picture. Still as Tharanga said you need to debug it.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Have the code like this :

    MESSAGE('%1',Status);

    IF (Status = Status :: Hired) THEN BEGIN

       Employee.INIT;

       Employee."No." := 'PC037';

       Employee."First Name" := "First Name";

       Employee."Middle Name" := "Middle Name";

       Employee."Last Name" := "Last Name";

       Employee."Job Title" := "Job Title";

       Employee.INSERT;

    END ELSE BEGIN

       MESSAGE('THIS IS NOT INSERTING');

    END;

    with this code you can check what is the value of the Status option field.

  • Community Member Profile Picture
    on at

    ok let me try this and revert back

  • Community Member Profile Picture
    on at

    still it is not messaging

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Where exactly did you place the code ? on which trigger ? or did you place this under an action button send me the screenshot where you placed the code.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    It seems you have not insert the code in the correct trigger. As Suresh said please share the screenshot of where you place the code.

  • Community Member Profile Picture
    on at

    that's the snapshot below

    8357.snapshot.PNG

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 > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans