<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=2171605496452306&amp;ev=PageView&amp;noscript=1">

121 - Coding In Dynamics NAV 2018

Coding in Dynamics NAV 2018

I have background in coding and use to code a lot in NAV and I don’t do it as much anymore or if at all, even though this is really interesting and I wish I was coding more I just have to pick the time that I use and the things that I wanna do.

If we go into this code over here, this is a code I got sort of on the internet, just copy pasted and made it run. It's basically showing you how coding will work in AL and if you are familiar with the old environment, In the old environment you would actually go into table, add a field there go into page add a field there etc, you can do that to some respect inside NAV but right now we are doing much more in code. Which I think is fine so, for example, here we have a table extension, we are extending a table which table? we are extending the customer table.

Extending the customer table.
We call this extension retail winter sport store and in here what we are gonna do is add a field, so I only have to specify the field that I’m addin, inside the fields here I have a field and it’s number 50,120 it’s called shoe size and then on validate we have a trigger that makes sure that we a not putting less than 0 and that's it.

Now of course this is the table, we need to also put it on the page, so here we have a page extension. Which extends the customer card, and here in the layout, in the general tab we’re adding the shoe size and on validate if the shoe size is less than 10, it's gonna display its gonna display feet are too small.

So just to show you how we actually operate in this, I’m gonna add one more fiel so, I go here into the fields and I can use something called a snippet, if I start with a T, I can just use T fields which is table fields, it automatically fields in what I need to type, so here I’m gonna call 50,122 and I just tap through, and I’m gonna call it coffee fan, so if that customer is fan of coffee I want to know. It's a boolean obviously I would never do this in real life, but anyways. And I don't need anything more, just gonna leave that empty. There is no trigger or anything on this one.

I would like to show this field also on the page, so I go here into the page into the layout , I’m fine with it showing in the general tab so I’m just gonna add that here and we had actually T fiel page down here , that will fill that out and I want it to bee Coffee Fan and that is the coffee fan; now it picked up, you can see ass I’m writing them is doing it together, It understands that coffee fan is a field, is very quick to pocup those things; And we want the caption ML in here that is actually important to find that, I have problems if I don't do that. I put that as Coffee fan, so now I just save it.

I just go up to debug I got to make sure that I'm not already debugging and start debugging. I run this and it connects to the server, the docker server, I logged in, I kept the customer list, so if I go into customer card I can now see I have shoe size and coffee fan. I’ve added these fields here. So If I wanted put here something like -5 its not valid so my trigger is working. It also says the feet are too small, that was another trigger that was there.

So hopefully you get this, this is actually how we code now in AL so its a little bit different than the way we did it in CA or PAL but the idea behind this was a little go into showing you that environment, I doubt that I’ll go much more into AL or maybe I’ll do who knows?, but I think I’ll start on another functional topic next week.



Get the Latest Video Tutorials in your inbox:

More Videos: