Category: AL Code

How to Create Unique Keys in AL Development/Business Central

Spring Release 2019 of business central comes up with new features for creating unique keys

Today we will see how to create unique keys in table

While creating second keys you can add an additional parameters said ‘Unique’. This will not allow duplicate values in the field where unique parameter is mentioned.

Now we will see this validation works on business central. Here we are trying put same description which is throwing error because of unique key.

You can define multiple unique keys in one table.

Points to Remember

  • Field can have empty value that means empty value is also value.
  • Not supported in table extensions.

Hope this will help you ..

How to Create Views in AL Development/Business Central

Now you all are aware the importance of creating views in windows client as it save the time of applying filters on the list of records. You can save the view with required filters and use it for future as it show the required data based on saved filters which improves productivity of users

Today we will see how we can create views in AL language.

Following examples illustrates how to create view from item list where inventory is greater than 10000.

In this example create new profile and added views in item list as below

Even you can apply more filters and order by also. As well as you can modify the page layout for the views as per your requirement

Publish the extension and open the business central web client .From setting change the profile and go to item List.

In the above picture you can see views has been added into the item list. Once you click on that view you can see the details as per define in views.

Following points need to remember.

  1. Can not use variables and methods .Can use only table fields
  2. Can not create new page controls from view.
  3. You can modify views from extension or customizations.

Hope you like this way of creating views in business central .Anyhow in upcoming versions there will option available on web client to create views as like windows client.

Cheers….

Cumulative Update Summary April 2019

Cumulative Update includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV.

Microsoft Dynamics NAV 2018 CU 16 :- NAV 2018 CU16

Microsoft Dynamics NAV 2017 CU 29 :- NAV 2017 CU 29

Microsoft Dynamics NAV 2016 CU 42 :- NAV 2016 CU 42

Microsoft Dynamics NAV 2015 CU 54 :-NAV 2015 CU 54

Warning

Before you install a cumulative update in a production environment, take the following precautions:

  1. Test the cumulative update in a non-production environment.
  2. Make a backup of the system or computer where the cumulative update is to be installed.

Stay tuned for more updates…

Page Inspection in Business Central

Till NAV 2018 we have features called as ‘About this page’ which is very useful to analyze the business data or deep insight the table for those fields which are not visible on main page or sub page.

In business central this features replaced with Page Inspection with more features.

How do I enable Page inspection

Choosing inspect from top menu or by pressing Ctrl+Alt+F1

You can see box on right size which shows details for current record.

Top Features

  1. Page name with id
  2. Table Name with id
  3. All table fields
  4. Extension name which extend this page
  5. Applied Filters.

Stay tuned for more

What’s new in the Spring 2019 release of Dynamics 365 Business Central?

With the release of spring version new features added/updated in Dynamics Business Central.

  • Application Enhancements
    • Longer name and descriptions across business central . It is increased from 50 characters to 100 characters.
    • Multiple Item selections for Sales & Purchase documents.
    • Merge Duplicate customers, Vendors and contacts.
    • Bulk Import of Item Pictures.
    • View Item ,customer and vendor descriptions in Ledger entries.
  • Save and Personalized List views
  • Focus mode on document pages.
  • AutoSave Indicator
  • Page Inspector.
  • Improvements in Scrolling lists.
  • Customize the theme
  • Application as an App
  • Force Sync when deploying applications
  • Multiple objects ID Ranges in app.json
  • Multiple unique keys
  • Increased Maximum length of texts and code fields, variables and text constants.
  • Event Runtime optimization :- It is now 1.5. to 2.5 times faster

Many more features are there in this new version.

Stay tuned for more.

Business Central 2019 Spring Release Available to Download

While Directions Asia 2019 getting wrap up we have spring release of Business Central available to download

You can download from following links

Microsoft Business Central Spring 2019 Release

Lets try and blog about new features

Cheers

How to Find Missing Prefix or Suffix -Business Central

As you all are aware the importance of having prefix and suffix in your app. In every extension you design need must have prefix or suffix on objects which include Table Extension, Page extension as well as control parts on pages. Benefits of this is that it will avoid collision of fields between two app which customer would like to install.

As a partner you need to register the prefix or suffix by sending email on d365val@microsoft.com. This will helpful when conflict arise so whosever registered will win.

Now when you convert the app from C/AL to AL then you need to huge task to us Prefix or Suffix in entire project.

To find all missing Prefix/Suffix you can enable AppSourceCoup which will help every time.

How to enable AppsourceCoup and complete ruleset You can visit https://amolsalvi.blog/2019/01/31/code-analysis-ruleset-business-central/

Apart from this you can create json file and mention the required prefix or suffix value as below

 {    "mandatoryPrefix": "ABCD"    } 

Hope this will help …


Code Analysis Ruleset-Business Central


A code analyzer is a library that builds on the compiler’s functionality to offer enhanced analysis of the syntax and semantics of your code at build time

CodeCop is an analyzer that enforces the official AL Coding Guidelines

PerTenantExtensionCop is an analyzer that enforces rules that must be respected by extensions meant to be installed for individual tenants

AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource

UserInterfaceCop is an analyzer that enforces rules that must be respected by extensions meant to be installed for individual tenants

To enable following rules we can use Code Analysis tools

Following are few rules for every code analysis tool .You can download from following file

Hope this will help you all..

How to upload File from URL using Extension in Business Central

Today we will see how we can upload picture from live URL on item card with extension.

For the above process created extension by extending item card.

Lets see how extension work to upload the picture from URL.

  1. Create new AL file with required name and by using page extension snippet extend Item card Page as below

2. Create a function to upload the file 

In the above function used HttpClient and HttpResponseMessage method to upload the file from URL.

3. Call this function on action on item card 

While passing parameter in function passed directly the URL from where I need to upload the picture on item card.

4. Compile and publish the extension and check the result.

5. Once you click on Upload file it will automatically upload the picture from URL on Item card.

This way you can upload the picture from URL rather than downloading on local drive and upload.

Isn’t it cool..

How Do I Upgrade to Business Central (on-premise)

Here are steps to upgrade to Business central .This is old way that is merging the objects into standard objects . Anyway not recommended to do this and it is better to create extension and publish it

Listed here some of the steps to upgrade business central from NAV 2018

  1. Merge all customization of old database to business central on-premises. Merging can be done using PowerShell(recommended) or manually (not recommend)
  2. Rectify all the errors and keep the object ready for upgrade.
  3. Take full SQL backup of old database.
  4. Install the Business Central from DVD.
  5. Uninstall allthe existing extensions from old database.
  6. Upload business central partner license into the old database.
  7. Delete all object except tables from old database.
  8. Clear all server instance and debugger breakpoints records from the old database.
  9. Make sure user with whom upgrade is carried out should have privileges of DB_Owner in Sql.
  10. Open business central development environment as an Administrator.
  11. Open the old database in Business central, which will ask for convert.
  12. Skip the schema synchronization at this point of upgrade.
  13. Import the upgraded objects on converted database in business central with selection of Replace All.
  14. Skip the schema synchronization at this point of upgrade.
  15. Import appropriate upgrade code unit from product DVD.
  16. Connect new database to appropriate NAV service.
  17. Increase SQL command time out to maximum number.
  18. Compile all objects with schema synchronization.
  19. Execute data upgrade process and import permission set.
  20. Make pages searchable by using ‘Build object search Index’ option from developer environment.
  21. Remove all unwanted objects
  22. Get Ready to face customer queries from new database