Can I auto-trigger a dataport on sales header update?

hello, I'm new and just wrote my first DataPort with some hello-world C/AL in NAV 2009 (updating is out of the question for the client).

Can I trigger my new DataPort to run every time a new Sales Header gets added or an existing one is edited and how?

Answers

  • RockWithNAV
    RockWithNAV Member Posts: 1,177

    Yes you can but the question is why you are on NAV 2009 version. Why not on Business central?

  • vaprog
    vaprog Member Posts: 1,166

    Can I trigger my new DataPort to run every time a new Sales Header gets added or an existing one is edited

    That would mean every time an insert or modify is made on the sales header record or (most likely) if an insert, modify, or delete operation is carried out on any record that is related to the sales header, such as sales line, sales comment line, extended text, …

    That is probably not what you want. So, first you need to think about the trigger condition, and probably remember that trigger event somewhere and create exports periodically, e.g. by creating a job in the job queue.

    and how?

    By adding code to the table triggers of any table that should serve as a trigger.

  • ramisin
    ramisin Member Posts: 2
    edited 2025-09-24

    thanks for the hint! F9 in the table doesn't work (the menu item for C/AL Code is greyed out)
    Is there a special licence required for table triggers?

    Yesterday I managed to get the Dataport to do what it should, so that's a small win

    I see your point about the condition - at least it's going to be a good exercise.

    I'm a bit flying in the dark as I only found a 4.0 version of the w1w1adgXXX.pdf file online (and no CD here) - if I could access that trigger, how would I instruct to "run Dataport number X now"?

  • vaprog
    vaprog Member Posts: 1,166

    Is there a special licence required for table triggers?

    Yes, there are different levels of developper licenses. You should contact your NAV Partner to help you with what you do not have access to with your license.

    Not sure what you can do. If you can design codeunits, implement everything there. Your parner can then verify your code and place calls to your functions in the triggers you do not have access to. But ask first, if he is willing to do that, and at what cost.

    I'm a bit flying in the dark as I only found a 4.0 version of the w1w1adgXXX.pdf file online (and no CD here)

    There is help in the development environment. Press F1 in the object designer or chose C/SIDE Reference Guide from the ?-Menu. This will tell you much of what you will need to know when it comes to C/AL. The system design did not change much between 4.0 and 2009, at least if you're on Classic(, which you probably are, if you are designing a Dataport. The RoleTailored client, as far as I know, does not support Dataports anymore. Instead there you must design an XMLPort, configured to handle flat files or csv files). So, the NAV 4 version of the Application Designer's Guide takes you a long way.

    How things are done in NAV you learn best by reading existing code. For anything you want to do, ask yourself, where does NAV have something similar. Then go and analyze that. Use it as a pattern for your solution.

    (and no CD here)

    Did you mean you do not have the installation media for your productive version? If so, ask your NAV Partner, if he still has a version matching yours. I would consider this a must-have for your business. Also ask your IT guy. He might have copied it somewhere on a network drive for easy installations of new client PCs.

    As a last resort, especially for documentation, you may try to download a version similar to yours. But don't just use it to install on some computer and then access your production version. You cannot downgrade, and to upgrade you likely need to convert the database and thus make it incompatible with your currently installd client and server software.

    One source for a NAV 2009 installation media, including programmer's documentation, is right here on Mibuso: Microsoft Dynamics NAV W1 2009 R2