We will go through a number of small samples in this blog to provide you with the information you need to create your own folders.
Example 1: Adding a new folder to a Sales Order Form
1. Connect to the UI (or use Single Sign On)
2. Open the ItemEvent and add the following code which will:
a. Access the Sales Order form
b. Catch the form load event of the Sales Order
c. Add a folder using the Item Type it_FOLDER. In this case we have created the new folder based on an existing folder (Accounting) so we copy the values top, height, width and left. We also put it next to the Accounting tab by using the GroupWith property.
d. When the form loads it then sets the focus back to the first folder (Pane level 1) which is the Contents tab.
3. Add another event in the Item event that will put the focus on the new tab when it’s clicked on.
In Business One this is how your new folder will appear in the Sales Order:
Example 2: Adding an item to the new folder on the Sales Order Form
In the above sample we can see that when we create the new empty folder we call a method called AddItemsToOrderForm which is the method we use in this example to add the items to our new folder:
1. Decide what type of items you want to add to the new folder
2. Use an existing item on an existing folder to place the new items on the new folder
3. Most importantly assign the ToPane and FromPane and this will determine on what folders these items are visible on.
In Business One this is how the new items will appear in the User Folder:
Example 3: Adding 4 subfolders within the new folder on the Sales Order form
We are going to now add 4 subfolders to the new folder we added to the Sales Order form and add some item types. We will also demonstrate how to make them visible on certain folders.
1. Add a new User Folder as highlighed in Example 1
2. Add 4 new Folders to the User Folder like we do with the Checkboxes in Example 2:
3. For all Item types you add ensure you set the correct PaneLevel. If you wish your new items to be visible in all 4 new subfolders it will look like this:
If you wish an item to be visible on the first two folders then the FromPane will be 10 and ToPane 12.
4. Finally we catch the Item pressed event on each of the new folders:
In Business One this is what appears when clicking on Folder 4:
Our next blog will cover the topic of how to solve errors you get when connecting to the DI API or DTW. So catch you then 🙂