Quantcast
Channel: Dynamics 365 Business Central/NAV User Group
Viewing all 11285 articles
Browse latest View live

Blog Post: Dynamics 365 Business Central: please always check AL warnings!

$
0
0
This is a quick post that want to describe a curious thing discovered 3 days ago. A partner contacted me on a social network (yes, I answer also on my socials but please don’t abuse on questions here, I have an email address…) and said me that he had problems on deploying an update of a per-tenant extension (big extension) to a SaaS tenant (the extension was previously working). The error that occours when publishing the extension was the following: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.ExtendedErrorTypeSymbol' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.FieldSymbol'. Nothing more… My first question to the partner was: do you have errors on your code? Answer: NO . And do you have warnings? CodeAnalysis reminds me to something related to code compiling… Answer: YES, a lot of warnings, but we don’t care about them now . Oh wait… you cannot forgot warnings without a check. So, we started checking the big list of warnings and I’ve discovered the following situation: in this extension (different developers works on the code), the partner creates a tableextension object for the Vendor table for adding a big set of fields. Then, in the new extension’s update, they modify the property of one of these fields in the following way (they forgot that the field was added in the tableextension object itself): As you can see, the field here is modified before its declaration. The AL language signals you that this is a warning: But unfortunately this is signaled only as a warning, not as an error. If you forgot to fix this warning and you deploy this extension to your SaaS tenant, you receive the above error message (that it’s not so intuitive for the developers I think). In my opinion, this warning should be converted as an error immediately. Please always check warnings in your code! A clean code should not have any warnings. The only admitted warnings where you can delay the fixes are the warnings related to Microsoft’s obsoletes things, where you have a time window to adapt your code to the new Microsoft’s refactored things. But at the end your extensions should always be “warning free”.

Forum Post: RE: NAV EDI tables

$
0
0
Hi Nala, Unless you either have a very very limited scope, or really want a project you can spent years "completing" then I'll recommend you to take a look at one of the many 3rd. party EDI add-ons that already exits. I've been in your situation a few times, and it always end up take much more time and require more tweaks to get it working. But if you decide still to do it, then you need to analyze exactly what kind of EDI system you talk about. What kind of documents do you need to exchange? Must you support standard edi formats like x99 or EdiFact? As always it's also import to know which version of Dynamics NAV are you using? I would recommend to look at the data exchange framework. It's basically an data import/export engine, but only available in the newer NAV versions.

Forum Post: RandInt and GenerateRandomCode20 always gives the same value?

$
0
0
Hello again, I am currently writing codeunits for Automated Testing in BC. I tried the GenerateRandomCode20 and RandInt from the Codeunit "Library - Utility" and Codeunit "Library - Random". But when i use them in different function the alwas create the same code what leads to the following error: The record in table XYZ already exists. Identification fields and values: Packaging Code='GU000000060000000000',Line No.='0' Some ideas how to avoid this behaviour? Thank you in advance.

Forum Post: How to Skip Certain Row from summation in RDLC

$
0
0
Doc.No. Item No. Sales Commission CD01 Item-01 100 10 CD02 Item-02 200 20 CD02 Item-02 250 25 CD04 Item-04 300 30 Total 850 85 * I have the above Rdlc summary report and I want to skip summation of any row if only when there is more than on document number appear in the list as indicated above. FYI: The summary report is executed from Document list using the following filter code CurrPage.SETSELECTIONFILTER(CommissionHeader); // fetch the marks IF CommissionHeader.FINDFIRST THEN BEGIN REPEAT IF noFilter <> '' THEN noFilter := noFilter + '|'; noFilter := noFilter + CommissionHeader."Document No."; // create filter expr. UNTIL CommissionHeader.NEXT = 0; CLEAR(CommissionHeader); CommissionHeader.SETFILTER("Document No.",noFilter); // create the filter END; REPORT.RUNMODAL(50082,TRUE,FALSE,CommissionHeader); noFilter:=''; Share your ideas Thanks in advance

Forum Post: RE: How to Skip Certain Row from summation in RDLC

$
0
0
Not at all sure what you are trying to do. Skip a certain row from summation? What do you want to do with that row? Basically if you want to skip a row from being included in RDLC, then you should prevent it from even going into the report. In RDLC you would be able to hide a line, but not exclude it from summation, if you are using RDLC's build in group/summation functionality. So you need to change the way the report is build, so that this is done in NAV, before it creates the dataset used for RDLC.

Forum Post: RE: RandInt and GenerateRandomCode20 always gives the same value?

$
0
0
Hi, I have never had any issues like that, it always worked fine for me. Which version of BC are you using?

Forum Post: RE: How to Skip Certain Row from summation in RDLC

$
0
0
Thanks for your reply, Mr. Earnst. The issue is I have a commission document were items listed for Agent for commission payment and this is a print summary report sent for approval and it is used to show what items the agent sold, qty, unit price and also commission per item sales. Whether there are single or multiple lines of items exist per document the total commission is summed up and calculated it that scenario but when multiple lines of items exist the summary report prints all lines including by repeating the summed up commission amount the total sum on the report for that specific document is doubled. All lines should be shown on the summary but only one line with the document commission

Forum Post: RE: How to Skip Certain Row from summation in RDLC

$
0
0
Mr. Ernst Can you suggest a solution I can try to solve my issue whether on the RDLC or in nav? Thanks again.

Forum Post: How to configure Business Central with No VAT

$
0
0
Hi All, I would like to configure Business Central so it does not have use VAT as I have a client who is not vat registered but cannot seem to do this. I know I can do journals with no VAT by unchecking the copy vat lines on the batch but for sales/purchases it wants me to set up VAT. I created the relevant posting groups and called them NO VAT and in the VAT Posting setup set the VAT% to be 0 but when you post it still creates a 0 vat entry line. I would prefer not to have this and would like to be able to the VAT functionality off. Is this possible? Thanks S

Forum Post: RE: RandInt and GenerateRandomCode20 always gives the same value?

$
0
0
Hey Erik, i am using BC 15. Here an example: I am calling this function from my own library codeunit various times in one of my test codeunits procedure CreatePackaging ( var Packaging: Record "XYZ Packaging" ) var begin Packaging . Init () ; Packaging . "Code" := LibraryUtility . GenerateRandomCode20 ( Packaging . FIELDNO ( "Code" ) , DATABASE ::"XYZ Packaging" ) ; Packaging . Validate ( "Packaging Type Code", CreatePackagingTypeCode ()) ; Packaging . Insert ( true ) ; end ; I think i might use [ TransactionModel(TransactionModel ::AutoRollback ) ] in the test codeunit. or a TestRunner with TestIsolation = Function ; as workaround.

Blog Post: Dynamics 365 Business Central and the new Microsoft Application "proxy" app

$
0
0
If someone of you has installed or upgraded a Dynamics 365 Business Central database instances with the new 15.3 version, I think that you could have noted that a new Microsoft extension is appeared on the Extensions Management page: What is this Microsoft Application app? This is a nice trick that Microsoft has done to solve a noisy problem that you could have if you modify the Base Application for the on-premise database. I’ve talked about this problem here in the past. If you modify the Microsoft Base Application and you change the appId or the name or the publisher , you break all the standard extension’s that depends from the Base Application . To permit this, Microsoft has silently introduced the Microsoft_Application.app file. This app is nothing magic, it’s just an empty app that acts like a “proxy” and it’s defined as follows: As you can see, this app has dependencies from the Microsoft’s System Application and Base Application (as every standard AL extension). Then, it has the propagateDependencies property set to TRUE. This property specifies whether the dependencies of this project should be propagated as direct dependencies of projects that depend on this one. What does it mean for you now? With this new “proxy app” you can now create a new extension with the following app.json file: As you can see, in my new extension here I have only a dependency from the new Microsoft Application extension. When you download symbols, also symbols from the Base Application are downloaded automatically: You could now customize the Base Application to suite your needs and you could also change the app’s details (publisher and so on). If you do so, you need to change the references to the app.json file in the new Application app and nothing more. All other extensions will work again. Embed partners and on-premises solutions can create a parent extension named Application , versioned according to base version, and with an appropriate, unique publisher. This parent extension is mainly used as an indirection proxy, and should contain explicit dependencies to the extensions actually implementing the application. In addition, the propagateDependencies property in the app.json file should be set to true. This will expose the dependencies to any extension taking dependency on the proxy Application version. Please remember that an explicit dependency to Microsoft’s Base Application will take priority over the Application version, but is redirected to “application” if the Base Application is not present on the system. I think we’ll see more about this later with version 16. Stay tuned…

Blog Post: Images fixed on vjeko.com

$
0
0
You might have noticed that I had some problems with pictures on this blog. Some posts simply didn’t show any of them, and I’ve got quite some reports that they aren’t working. Unfortunately, I’ve been so busy recently that I really didn’t have time to look into it. A few days ago, a regular visitor of this blog that goes by the name of Bjarki took time to figure out what’s going on. He posted a comment about his finding, and that’s truly amazing. Thanks, Bjarki! Apparently, when I moved my blog to a new server, for some reason, some of the pictures got referenced with the staging URL and that URL remained in my blog database. Bjarki’s hint explained to me that the fix may be simpler than I feared. I did a search and replace (using the amazing Velvet Blues Update URLs plugin for WordPress) and voila! I hope I get time soon to do other stuff on my blog, I know you are waiting for the continuation of the control add-ins supercharged series. It’s coming, it really is. Read this post at its original location at https://vjeko.com/2020/03/12/images-fixed-on-vjeko-com/ , or visit the original blog at https://vjeko.com . 5e33c5f6cb90c441bd1f23d5b9eeca34 The post Images fixed on vjeko.com appeared first on Vjeko.com .

Blog Post: Using Deployment slots for your Dynamics 365 Business Central Azure Functions

$
0
0
In my session at Ignite Tour Milan in January I’ve talked (with a real demo too) about how to use Deployment slots when you need to deploy a web application in the cloud and you have the need to separate the production environment from a “testing” environment or a “preview” environment (for scenarios where you want that only some users can use the preview version of your application). I’ve received the following question from some attendees: we’re using Azure Function for our customers in Dynamics 365 Business Central SaaS. Can we use deployment slots also for Azure Functions ? The answer is YES and I’ve promised a more detaild explanation here. Now it’s the time In an Azure Cloud service, Deployment slots permits you to have different isolated environments for your application and you can easily swap between environments with just few clicks. For example, you can have a production slot where your released production application is running and then you can have a staging slot where your “under development” version of the application is released. Deployment slots for App Service are quite common when you’re working with web apps on Azure, but what about Azure Functions? Yes, Azure Function support deployment slot features too and you should use this feature. To create a new deployment slot for an Azure Function, go to the Azure Portal, select your Function’s app and under Slots click the + button to add a new slot: In the Create a new deployment slot window, select a name for your slot and click Create : Here I’ve created a slot called testing because I want a new endpoint (slot) for deploying a new preview version of my Azure Function without affecting the stable production environment. Now the deployment of your slot starts and when finished you will have a new slot created (here called testing ). As you can see, we have now two slots: the production slot (the first red box in the below image) and the testing slot (second red box): As you can see in the above image, the testing slot has its own url and no functions deployed on it yet: You need now to deploy your Azure Function to the testing slot. We can directly perform this task from Visual Studio (where we have our Azure Function preview version to deploy in the cloud). Right click the solution and select Publish . In the Publish window, click on New to create a new publishing profile and from the Pick a publish target page select the Select Existing option for your App Service plan: You can now search for your existing App Service instances where to deploy your function and you can now also select the available slots: By selecting the desired slot (here I select testing ), clicking OK and then Publish , your Azure Function is deployed to the newly created slot: and the new codebase responds to the testing slot url (new endpoint). In this way, you can have a set of your customers that tests the new function implementation while all the other customers continues to use the production endpoint. Two different versions of your Azure Function are now live in the cloud. When your tesing is finished and you are ready to push the new Azure Function version to all the customer’s base, you can simply swap the testing slot into the production slot. This can be done by clicking the Swap action in the Azure Portal: This will swap the Source instance to the Target instance: Remember that if you have different settings between slots, you need to check if also settings must be swapped or not. If you want to perform a rollback, just swap again the slots. This is a recommended best practice to adopt if you work with Azure Functions for Dynamics 365 Business Central. You should never change the function’s code directly in the production instance without testing, because this could affect all your customers. Working with slots can help you on having a more reliable solution.

Forum Post: RE: Report issue BC SaaS

$
0
0
Hi All, Anybody faced this type of issue any time? Thanks in Advance

Forum Post: Document Attachment via OData

$
0
0
I'm trying to add a Document Attachment record via a Connected Service to a Microsoft Dynamics NAV database in C# (Visual Studio Professional 2019), (see code below):- const int SHTABLEID = 5900; string lstrFileName = @"C:\BCTest\Test Attachment 3.pdf"; System.IO.FileInfo lfi = new System.IO.FileInfo(lstrFileName); NAV.API_Document_Attachment lobjDA = NAV.API_Document_Attachment.CreateAPI_Document_Attachment(SHTABLEID, "SO000006", "Order", 0, 1); lobjDA.AttachedDate = DateTime.Now; lobjDA.FileName = lfi.Name; lobjDA.FileExtension = lfi.Extension.Replace(".", string.Empty); lobjDA.FileType = "2"; FileStream lobjFS = new FileStream(lstrFileName, FileMode.Open); byte[] larrFileBytes = null; using (var ms = new MemoryStream()) { lobjFS.CopyTo(ms); larrFileBytes = ms.ToArray(); System.Guid lobjGuid = System.Guid.NewGuid(); lobjDA.DocumentReferenceID = NAV.Media.CreateMedia(lobjGuid); // I think some code is required here to populate lobjDA.DocumentReferenceID.Content } gobjDSC_Bell.AddToAPI_Document_Attachment(lobjDA); gobjDSC_Bell.SaveChanges(); The bit I think I'm now missing is, how to populate the Content property (type: Microsoft.OData.Client.DataServiceStreamLink) of the DocumentReferenceID (type: NAV.Media) I'm getting error: 'Please attach a document first.' at SaveChanges.How do I attach the document / file? NAV details below:- Version: Platform 14.0.29530.0 + Application 29537 (GB Dynamics NAV 14.0)

Forum Post: Installing extension with script

$
0
0
Hi everyone, I think my question is quite simple... Is it possible to install an extension into a cloud tenant with scripts? Thank you very much

Blog Post: Dynamics 365 Business Central: something more about dependency propagation

$
0
0
One week ago I’ve written a post about the new “proxy app” ( Microsoft.Application.app file) introduced with the 15.3 version ( you can read the post here ). This app uses a new property called propagateDependencies that permits you to specify whether the dependencies of this project should be propagated as direct dependencies of projects that depend on this one . As you can imagine, this is not a property specific to this new “proxy app” but you can use it too in your extensions, but be aware of some aspects (and this is why I’ve decided to write this post). In this demo scenario, imagine to have an extension A (your main application) that depends only on the Microsoft’s System Application and Base Application , then you need to create extension B (that depends on A and on the System Application and Base Application ) and then you create extension C (that depends on A and B and also on the System Application and Base Application ). A schema of the solution is represented as follows: My extension A is a Task management system (just a fantasy app) and it’s declared as follows: As you can see, I’ve used the propagateDependencies property set to TRUE in order to propagate the declared dependencies to other apps that depends on A . To use the propagateDependencies property you need to set “ runtime”: “4.3” (version of the runtime that the project is targeting). In this extension (just for demo purposes) I’ve declared a table object called Task , an enum object ( TaskStatus ) and a list page ( Task List (SD) ). Code is as follows: This app A is deployed on my tenant. Then, I create extension B as follows: As you can see, I’ve used again the propagateDependencies property set to TRUE (to be able to propagate its dependencies) and in the dependencies block here I’ve declared the dependency only from the extension A . This is possible because A has propagateDependencies = TRUE, so you inherits also the dependencies from the standard Microsoft’s apps. This extension B adds only a new value to the TaskStatus enum object declared on A (but in a real world you will do more than this). If you download symbols, you can see that also the standard Microsoft’s symbols are downloaded, also if not declared as direct dependencies: Now it’s the time to create extension C . In this simple example, C will contain only a codeunit that handles the OnAfterValidate event of the Task status added on extension B and creates a new function that works on the Customer entity. Extension C (as you can see in the application diagram in the first image) must have dependencies from the standard Microsoft’s apps ( System Application and Base Application ) and also from A and B . But A and B have the propagateDependencies property set to TRUE, so it’s quite natural to declare C as follows: In this way, I’m expecting that C depends on B , but B has a dependency chain where dependencies are propagated to the lowest level ( B depends on A that propagates its dependencies too) and so I want to be able to see objects declared on B , on A and also on the standard Microsoft’s Base Application . What happens if you download symbols from extension C ? As you can see, downloaded symbols are only from extension B (direct dependency) and from extension A (propagated from B ). The complete dependency chain (from A to Base Application ) is not inherited here. From C , I can then work on objects declared on A and on B (see the event subscriber) but I cannot reference objects declared in the Base Application (see procedure Foo , where Customer is unknown). To have all this working (the expected behaviour mentioned above) it’s extremely important to handle the “application” property (that permits you to specify the version of the dependent base application). If you set this in your app.json file: All base application’s symbols are correctly downloaded. Nice, isn’t it? Happy coding

Blog Post: NAV 2017 and Job Queue Entry cards failing without error message

$
0
0
Dear reader This week I faced an interesting issue at one of our customers that had changed their Dynamics Partnership to us from another partner. They are running NAV2017 and using Job Queues to handle their incoming and outgoing integration message transfers. There is like 20 recurring Job Queue Entry cards that run anything between one minute to 10 minutes interval. Things have been running quite nicely for a long time, but suddendly they started witnessing JQ cards failing without error. There was some that were failing because of table locks, but that is normal behaviour. Strange thing was that the number of failing JQ Entry cards suddenly increased so that the Job Queues stopped working. So, JQ card in error, no error message, what is this magic? I started searching what could cause this, and first checked the Cumulative Updates that might apply. This did not help, since the customer already had all the latest fixes on this functionality installed. Next I searched the web, and found out that there has been some problems in older NAV versions with Job Queues, and one even almost identical to ours, blogged by Ponç J. Llaneras https://dynamicsuser.net/nav/f/technical/95132/job-queue-not-always-works I had earlier implemented similar approach as Ponç to fix the symptoms and give me some peace to work with the issue, so the problem was hushed away, but of course I just had to find the real reason behind this. So, I started digging more, and finally I found an event viewer Application log that had identical timestamp with message " Operaatiota ei voitu suorittaa, koska toinen käyttäjä lukitsi tietueen. Yritä toimintoa uudelleen. " This is Finnish translation for error message " The Operation could not complete because a record was locked by another User. Please retry the activity ". Interestingly, the table that was mentioned in the Event Viewer message was not Job Queue Entry, nor it was Job Queue Entry Log, but "Record Link"! Statement: INSERT INTO "NAV2017".dbo."Record Link" ("Record ID","URL1","URL2","URL3","URL4","Description","Type","Note","Created","User ID","Company","Notify","To User ID") VALUES (@0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12) SELECT @@DBTS,CAST(SCOPE_IDENTITY() AS INTEGER) Now this was really interesting. I checked the Record Link table, and found out that it was infested with messages that were addressed to NAS service user, with over more that 5 million records. 5 million records for an user that doesn't even exist in the database! Record Link table is also used heavily for notifications when users print some parcel address labels as a background jobs, and also scanned thoroughly when any user logs in, just to show the notifications that are waiting for him in the home page. The easy solution? Yes, just add field "Notify On Success" to Job Queue Entry Card, and clear the field for integration jobs. After that you can just delete all of the notifications from Record Link table in order to make it nice and clean again.

Blog Post: The new life with an app-based ERP

$
0
0
Some days ago I wrote an article for Simplanova website for summarizing the biggest technical changes that every partner should start thinking and managing in order to be able to work efficiently with the new Microsoft Dynamics 365 Business Central platform. This is my personal opinion but I hope it will be a good starting point for everyone in order to start thinking on how to change its internal development processes. The new platform in a big revolution, it breakes the old monolithic codebase and it introduces a lot of new technical tasks and technical complexity that a Dynamics ERP partner must be aware of and ready to handle: Now, you cannot only think on translate your business case into code (tipical NAV scenario), but nowadays when starting a new implementation every partner should start thinking on: Refactoring and rearchitecturing their solutions in order to be on top of the standard Microsoft’s app (and to be SaaS compliant) Handle dependency chain problems Handle solution’s extensibility Handle source control management and CI/CD processes Handle monitoring of their apps Renewing their product development strategy Read the article here and feel free to share your thoughts…

Forum Post: find Azure tenant ID from Business central code

$
0
0
Hi All, I want find azure tenant ID from Busness central code. Please suggest how to find tenant ID. businesscentral.dynamics.com/ [TENANT_ID] /admin Thanks
Viewing all 11285 articles
Browse latest View live