ArcherPoint Dynamics NAV Developer Digest - vol 272
Triggers in D365 Business CentralKyle posts on Yammer: "Has anyone else seen that even if you do Record.Insert(false), Business Central Still fires the OnBeforeInsert and OnAfterInsert triggers?"
Matt T. responds: "That is by design. The event subscribers have a parameter that is passed, named Retrigger. If you only want the code in your subscriber to execute when Insert(true) is called, you need to stick 'If not RunTrigger then exit' at the top of your subscriber."
Kyle is adamant: "This. This is why Yammer attendance should be mandatory. Not only did I learn something important, but Matt fixed my customer problem, too. Keep caring and sharing, mad ArcherPoint peeps..."
Bill W. adds: "If not RunTrigger then exit' should probably be the default based on this Vjeko post on OnTable Event Subscriber Patterns and Antipatterns."
Saurav adds: "In upgrades, when subscribing all table trigger events other than Rename Trigger, developers need to have this line mandatory: 'if not RunTrigger then Exit'. We faced this issue early on with upgrades and also did code corrections for add-on partners to add the first statements when they subscribe to these events."
Dynamics NAV 2018 Record LocksFaithie asks: "In NAV 2018 is there ANY way to tell who is producing a record lock? One client has them on occasion, and when they do, it becomes a proverbial train wreck! Please and thank you!"
Bill W. helps out: “See this article on SQL Server Extended Events to Produce a Blocked Process Report. You won't be able to see the user, but you'll be able to see the process. Turn on the feature in SSMS. Instead of creating the extended event report, I go to SQL Profiler and choose the ‘blocked process report’. You'll see the SQL statements of the blocking and blocked processes.”
A Helpful Tip When Using Word as the Default Layout when Creating an AL Report
Ryan provides a helpful tip: “If you create an .AL report that uses a DefaultLayout of Microsoft Word, and that report name has spaces, you can't use that same .docx file to import a custom layout in Business Central. I created an .AL report with a default layout of Word, and it created my .docx for me. I then edited the .docx, built, and published the app. The app was published to the sandbox. Now, I want to make some changes to the Word layout, so I took the original .docx and changed a few things. However, when I tried to import the layout in the sandbox, I got an error. Here's why:When you build the app, it will create the .docx for you, using the report name in the template. However, when you export a custom layout, it will replace the spaces with underscores. It’s not a big deal if you remember to export the custom layout first, and then edit it before importing it. I just spent a certain amount of time editing the original one, which now I need to do again (you can't copy and paste the content controls).” If you are interested in Dynamics NAV and Business Central development, be sure to see our collection of NAV/BC Development Blogs. Read the "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.
- Login Error: Communication protocol mismatch between client and server
- Creating a Date Table in Power BI
- The Top Eight KPIs Retailers Should Be Tracking (with Formulas) for Your Retail KPI Dashboard
- Difference Between IaaS, PaaS, and SaaS And When You Need to Use Them
- The Microsoft Technology Stack – What It Is and Why You Should Care