Sunday, August 19, 2018

D365 Business Central - Use code analysis to prevent strange errors

Hello Friends,

You’ve developed a marvellous ðŸ˜€ extension for Dynamics 365 Business Central and tested it on your development sandbox without problems. Now, you try to deploy it to a production environment via the Upload Extension action on the Extension Management page and fail to publish. 
Publish operation failed. Details: Extension validation failed. View the error details for more information.
What error details? Unfortunately, Microsoft actually does not provide a great way to see what is the cause of these types of errors, but they are actively working on improving the error status information in Dynamics 365 Business Central, so stay tuned. - After June 2018, Microsoft provide the detail descriptive error logs. 
But, what can I do now? I’ve experienced many times that this error is caused by rules not met on your extension. I think it’s extremely helpful to activate the code analysis tools that Microsoft actually provides for the AL language because they can help you to prevent failures.
The AL Language extension for Visual Studio Code contains three code analyzers:
  • CodeCop is an analyzer that enforces the official AL Coding Guidelines. For more information, see CodeCop Analyzer Rules.
  • PerTenantExtensionCop is an analyzer that enforces rules that must be respected by extensions meant to be installed for individual tenants. For more information, see PerTenantExtensionCop Analyzer Rules.
  • AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource. For more information, see AppSourceCop Analyzer Rules.
There’s a great blog post by Waldo that explains how to activate, use and customize them, so I don’t want to write more on that here (he’s the king!).
On your Visual Studio code, you can go on File -> Preferences -> Settings and here activate the analyzers by adding the following line in the User or Workspace settings:
ALCodeAnalysis_01.jpg
This line activates ALL the AL code analyzers and in my opinion it’s only for real world purists ðŸ˜€
This is what happens when I compile an extension that works and that doesn’t have any types of errors or warnings when I don’t have the analyzers activated:
ALCodeAnalysis_02.jpg
As you can see, there are lots of “unuseful” warning regarding parenthesis, BEGIN..END and so on.
Activating all the analyzers could be too much, but I suggest to activate at least the PerTenantExtensionCop analyzers when you want to deploy your extension to a production environment (per-tenant extension, not AppSource):
ALCodeAnalysis_03.jpg
Now, if you compile the previous extension with all this analyzers activated, this is the result:
ALCodeAnalysis_04.jpg
Now the compiler listed only problems that can cause conflicts when installing the extension on a production tenant.
My suggestion (only based on experience, so feel free to comment) is to solve all these problems in your code and then deploy to production. The previously reported error in many cases will disappear. If not, your last chance is to call Microsoft ðŸ™‚

D365 Business Central: 3-Character prefix require for AppSource Apps Development

Hello Friends,

If you planning to develop extension (apps) for D365 BC of Microsoft App Source, than you have to request and register 3-Character prefix/suffix code for your organization with Microsoft

For example, at Intech-Systems we had register "INT" as our organization unique code. So, D365 BC team will reserve this code for us and we have to use this code for apps development as following.

 List of examples....


  • Object prefix must be registered with Microsoft (at least 3 digits) and must be unique (it’s globally reserved for you)

  • It can be a prefix or a suffix (you can call an object XXXMyTable or MyTableXXX)

  • You have to use it for every objects in your extension

  • This is case insensitive (you can call an object XXXMyTable or xxxMyTable)

  • You can use the prefix in any format you want (XXX_MyTableXXX-MyTableXXX.MyTableXXX MyTable etc. are all valid names)

  • You can register more than one prefix (you can have a prefix for app but I think this is not a good way to do, I prefer a prefix for company)

  • Functions in your extension objects cannot have the prefix/suffix in names (the prefix is in your object name, so you can have something like XXX-MyCodeunit.MyWonderfulFunctionNameLongAsIWant() )

  • If you have extension A that depends on extension B and extension C, and both B and C adds a function MyFunction to a standard table (Customer table for example), if you call Customer.MyFunction you receive an error on compilation (ambiguous call)

  • If you create any extended page/table object than object name should contain it.                Example - pageextension 70144371 INT ExtendItemCard extends "Item Card"

  • Use in name of action/group added in standard page/rolecenter, see the following example
  •     actions 
        { 
            addafter("Purchase Invoice") 
            { 
                group("INT Item Generator") 
                { 
                    action("INT Item Configurator List") 
                    { 
                        Caption = 'Item Configuration'; 
                        ApplicationArea = all; 
                        Image = ItemTracking; 
                        Promoted = true; 
                        PromotedCategory = Process; 
                        PromotedIsBig = true; 
                        RunObject = Page "INT Item Configurator List"; 
                    } 

  • Use in name of field added in standard table (by extended tales object)

  • Microsoft want to make you extension object name should be unique and remove the conflict between and N-number extension in app source,

    Hope this blog will help you. Write a comments if you need more help.

    Thank you,
    Keep Sharing....Keep Growing...

    D365 BC add page in search list by using Property UsageCategory and ApplicationArea

    Hello Friends,

    I’ve see many AL developers with the same problem when developing an extension for Dynamics 365 Business Central: they create a new table, then they create a new page based on that table, they set UsageCategory and ApplicationArea properties, they deploy the extension to Dynamics 365 Business Central with success, then they search for the newly created page and… it’s not there!!! 😦

    This problem (I didn’t check if it occours on all the Dynamics 365 Business Central versions, current one or also insider builds) is due to a stupid thing: don’t use quotes when setting UsageCategory and ApplicationArea.

    This is a code that works:

    UsageCategoryProblem_01.jpg


    And this is a code with problems while searching your page:

    UsageCategoryProblem_02.jpg

    These two versions doesn’t have problems when compiling your AL code on Visual Studio Code (all versions are admitted) but the first one is what you have to do if you want to find your page in Search without problems.

    Hope it helps.

    Sunday, August 5, 2018

    Publish first app of D365 Business Central on Microsoft App Source

    Hello Friends,

    We are glad to inform that our first app of D365 Business Central Published on Microsoft App Store.
    It was long procedure of couple of months..at last we done it !!

    We have learned lot of new things while developing extension on VS Code, We have great future ahead and there are many things to learn. Prepare your self for new generation development tools.

    Item Code Generator

    Use Item Code Generator with Dynamics 365 Business Central to easily identify, search, and refer you items code, Give the logical code to inventory items.


    Features:
    • Generates uniform item master automatically
    • Checks and notifies for duplicate Item code
    • Step by step category attribute selection to generate a unique Item code
    • Creates Logical item parameter
    • Creates dependency of attributes, if any
    • Automatically generates item description based on selected attributes value
    • Generated Item Code will be listed in item master automatically
    • Attach item DATA TEMPLATE with item configurator
    Benefits:
    • As inventory management becomes more efficient with Item Code Generator, it helps in identifying product loss and creating transparency.
    • Item codes are highly effective when you’re dealing with thousands of products. Naming them all and adding descriptions is a tedious task if done manually. This app avoids human errors like duplication in counting of items, counting wrong items, etc.
    • Managing huge inventory is difficult. With Item Code Generator, knowing how much of each product is in hand becomes easy. You can set alerts when a certain product runs out of stock or is less than a minimum level set.

    Check this out on Microsoft App Store:



























    If you need any help to developed and publish your app on than write a comments here. 

    Thank you for reading.
    Keep Sharing.... Keep Growing....