ID Assigning – Boost Your Productivity with AL/BC

ID Assigning – Boost Your Productivity with AL/BC

This post is part of the blog post series “Boost Your Productivity with AL and Business Central”. If you want to know more about what this series is about and why I created it, you can checkout this post.

What This Post Is About

Today I deliberately keep the post short. It is about the automatic assignment of an ID for .al objects. Some of you may already know this trick. For others, who do not know it yet, it will make your work much easier.

You will from now on never have to go through your objects or remember which IDs are still free. Yippee-ki-yay, …!

Example: Assigning an ID automatically

The app.json file of our example has an ID range of 50100-50149. This defined range is used to assign the next possible ID. Follow this link for more information about JSON files in Business Central.

id range

For our example we create a new table in our project. We use the “ttable” snippet.

ttable snippet

But instead of assigning the ID ourselves after careful consideration, we let Visual Studio Code help us. To do this, we use “LEFTARROW” once. This will move the cursor to the beginning “ID” part of the snippet.

It is important that we place the cursor in front of the “id”. If we do not place it there, the suggestion list of possible actions will be different.

Press “CTRL” + “SPACE” to open a list of suggestions. Also included in this list is our ID. How cool is that?

Navigate with “DOWNARROW” to the suggested number and press “ENTER”. Done. Happy faces. Cheering. Wow. Awesome.

id

Note: Depending on what extensions you have installed, it may be more difficult to find the ID in the list of suggestions. Sometimes “penetrating” snippets can be the first choice here. Therefore, it can save you time if you type in the first digit yourself after opening the suggestion list. Only one suggestion will then appear, which you can select directly.

first digit

Hope this helps. Have a nice week! 🙂

Leave a Reply

%d bloggers like this: