Quantcast
Channel: ArcherPoint Developer Blog
Viewing all 372 articles
Browse latest View live

Journey into Mystery! Working with RecordRef Variables in Dynamics NAV

$
0
0

Journey into Mystery! Working with RecordRef Variables in Microsoft Dynamics NAV

The RecordRef and FieldRef variable types are used in Microsoft Dynamics NAV to handle working with a record and fields in a record when you don’t necessarily know which record or fields you’ll be handling. In this blog entry, I’ll write about how to work with them. NOTE: These instructions should apply to all versions of Dynamics NAV from version 3.7 up to and including Dynamics NAV 2013 and Dynamics NAV 2013 R2.

 Writing code around Microsoft Dynamics NAV, you may have seen the RecordRef, FieldRef, and KeyRef variable types. If you’ve never gotten to use them, you probably don’t quite know what they are or how they work. These three variable types are used when you know that you need to work with a record or set of records, but you don’t know exactly which table you’ll need to access.

Generally, I’ve used RecordRef variables under two different circumstances. Either I needed to do the same operation with several very similar tables, like Sales Header and Sales Invoice Header and Sales Shipment Header, or I’ve needed to do the same operation on a whole bunch of tables having nothing in common. In either situation, the thing that drove me to RecordRef variables was that I didn’t know which table I’d be dealing with until runtime. (The biggest project I had to do using RecordRef involved synchronizing records between NAV and an external database in real-time via web service calls; I used the OnGlobalInsert, OnGlobalModify, OnGlobalDelete, and OnGlobalRename triggers in the ApplicationManagement codeunit to call some web services along with RecordRef variables to send the data over.)

RecordRef is basically a normal Record variable, only requiring that you feed it the table number so that NAV knows which table you want to work with. You do that via the RecordRef.OPEN function, which takes three parameters:

  • No. (required): This is the table number that you want to work with. You can use the DATABASE::[table name] option variable to find the number of the table that you’re wanting to use, if you don’t know it ahead of time.
  • Temp (optional): This is a boolean telling the system whether you want to open up a temporary table (TRUE) or a real table (FALSE). If you omit this, the system assumes you want a real table.
  • CompanyName (optional): This is the NAV company name that you’re working with. If you omit this, the system assumes you’re working with the current company.

There are some other important functions to know about with RecordRef variables. RecordRef.GETTABLE is used to point a RecordRef at the same table instance as a Record variable, and RecordRef.SETTABLE is used to point a Record variable at the same table instance as a RecordRef variable. You can use GETTABLE and SETTABLE to transfer data between a RecordRef and a normal Record variable.

You can use the FINDFIRST, FINDLAST, FINDSET, and NEXT functions of a RecordRef variable to loop through a recordset, just like you would with a Record variable. And you can set filters on a RecordRef by using FieldRef variables; we’ll cover that below. You can also use the INSERT, MODIFY, DELETE, and RENAME functions to modify a record using RecordRef; note that they can be run with TRUE or FALSE parameters to trigger the OnInsert/OnModify/OnDelete/OnRename trigger in the appropriate table.

To access the fields of a record in a RecordRef variable, you have to use a FieldRef. A FieldRef is basically like a field in a Record variable, but with some special changes made to handle the fact that it could be any time.

There are two ways to access a record field with FieldRef. You can either load the field into a FieldRef using the RecordRef.FIELDINDEX function, or you can use the RecordRef.FIELD function. FIELDINDEX requires that you feed it the order in which the field appears in the table—the first field is 1, the second field is 2, and so on, regardless of the Field No. property in the underlying table. FIELD requires that you feed it the Field No. property from the underlying table. You can find the Field No. for a field by accessing the FIELDNO property of any record variable, feeding it a field name.

If you want to look at all the fields in a record variable, you can use an integer counter and the RecordRef.FIELDCOUNT property to load them with RecordRef.FIELDINDEX. If you want to look at specific fields, then you use RecordRef.FIELD.

FieldRef variables can be read from or written to with the FieldRef.VALUE property. The data type for FieldRef.VALUE is a variant, so you can write any valid NAV data type to it.

You can use FieldRef.SETRANGE and FieldRef.SETFILTER to set filters on a RecordRef. You can also use RecordRef.RESET to clear all the filters on a RecordRef variable.

For regular Record variables in NAV, you can use the GET function along with the primary key values to grab a specific record from the database. However, you have to use a special type of variable called a RecordID to grab a specific record from the database for a RecordRef. A RecordID is a specially-encoded value holding the primary key for a RecordRef variable. You can use the RecordRef.RECORDID function to find it for a RecordRef variable. If you wanted to get the RecordID from a Record variable to use with a RecordRef, you need to convert the Record variable into a RecordRef first by using RecordRef.GETTABLE and feeding that the Record variable.

Here’s a sample codeunit I wrote with RecordRef and FieldRef that would compare two different records and give you a message if there were any differences. You might want to use something like this if you were checking to see if a record had changed and updating some things accordingly.

NOTE: You can download this codeunit here.

OnRun()

Cust.GET('10000');

Cust2.GET('10000');

Cust2.Name := 'Changed';

CLEAR(RecRefCust1);

RecRefCust1.GETTABLE(Cust);

CLEAR(RecRefCust2);

RecRefCust2.GETTABLE(Cust2);

RecordCompare(RecRefCust1,RecRefCust2);

RecordCompare(RecRef1 : RecordRef;RecRef2 : RecordRef)

ChangesMade := FALSE;

lCounter := 1;

REPEAT

 CLEAR(FldRef1);

 FldRef1 := RecRef1.FIELDINDEX(lCounter);

 CLEAR(FldRef2);

 FldRef2 := RecRef2.FIELDINDEX(lCounter);

 ChangesMade := (FldRef1.VALUE <> FldRef2.VALUE);

 lCounter += 1;

UNTIL ChangesMade OR (lCounter > RecRef1.FIELDCOUNT);

IF ChangesMade THEN BEGIN

 MESSAGE('The records do not match.');

END ELSE BEGIN

 MESSAGE('The records are the same.');

END;

Subscribe to Tom Hunt blogs, or, for more information on topics related to Microsoft Dynamics NAV development, read the ArcherPoint Developer Blog written specifically for Microsoft Dynamics NAV developers.


ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 12

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 12

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

ArcherPoint CEO Greg Kaupp and other employees compiled a reading list of professional and personal development that they found helpful over the last few years:

Tribal Leadership, Dave Logan
The Three Laws of Performance, Dave Logan & Steve Zaffron
Traction, Gino Wickman
Lessons from the Mouse, Dennis Snow
Unleashing Excellence, Dennis Snow & Teri Yanovitch
The Five Dysfunctions of a Team, Patrick Lencioni
The Four Obsessions of an Extraordinary Executive, Patrick Lencioni
Good to Great, Jim Collins
Agile Estimating and Planning, Mike Cohn
Agile Software Development with Scrum, Ken Schwaber & Mike Beedle
Blue Ocean Strategy, W. Chan Kim & Renee Mauborgne
Switch: How to ChangeThings when Change is Hard, Chip & Dan Heath
Decisive: How to Make Better Choices in Life and Work
Winning Decisions: Getting it Right the First Time
, J. Edward Russo and Paul J.H. Schoemaker
The Invisible Gorilla: And Other Ways Our Intuitions Deceive Us, Christopher Chabris and Daniel Simons
Getting Things Done, David Allen

Faithie Robertson on Dynamics NAV 2013 R2 error: Object Metadata table is locked by another user:

NAV2013 R2 "Object Metadata table is locked by another user" Error when trying to save changes to an object: This can occur when trying to save a change in NAV in the 2013 R2 version. This is due to the way the Object Metadata table is used when the changes are synced to SQL, either through the PowerShell "Sync-NAVTenant" command or the access of the object by the first user if it was not synced. We've encountered this before.

Here's an article by Mark Brummel that explains further:

NAV 2013 R2: The Object Metadata table cannot be changed because it is locked by another user

Dan Sass shared information on updates to the Costing Error Detection and Data Correction white paper: 

Costing Error Detection and Data Correction white paper– updated for Microsoft Dynamics NAV 2013

Jon Long shared a link about Excellence:

“We are what we repeatedly do. Excellence, then, is not an act, but a habit” – Aristotle

Read the entire post: Personal Strengths – We Are What We Repeatedly Do

Owen McDonald added this link on Benjamin Franklin’s list of virtues:

“Be not disturbed at trifles, or at accidents common or unavoidable.”

“Use no hurtful deceit; think innocently and justly, and, if you speak, speak accordingly.”

“Wrong none by doing injuries, or omitting the benfits that are your duty.”

Read the full post: The Virtuous Life: Wrap Up

In Business Analysts, Alan Campbell shared this post about using “Planguage”:

Specifying Quality Requirements with Planguage

Also in BA, Alan shared this post on 2 minute models:

2 Minute Models: A walk through the Feature Tree Model

Lynette Chronister added this link for visual templates from seilevel.com (complete the form to access the templates):

Visual Models for Software Requirements (RML)

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 13

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 13

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Kyle Hardin on Windows 7 shortcuts:

Windows-M – minimize all applications

Windows-Home – minimize everything but the current app

Windows-Shift-RightArrow – moves current app from main monitor to the right monitor
Requires multiple monitors (Windows-Shift-Left does the opposite)

Windows-L – lock the computer

Windows (by itself) – then start typing
This is how I find all apps that aren't up on the task bar. I haven't missed the Start Menu one tiny bit.
Example: Windows W O R D (then hit enter) runs Microsoft Word

Review the complete list at Lifehacker’s Master List of New Windows 7 Shortcuts

Dan Sass shared a link from Harvard Business Review on quantifying the customer experience:

“Of course, the rationale we often hear for not investing to deliver a great experience is that the cost is high. Speaking to executives inside these businesses, however, we often hear the opposite. That is: delivering great experiences actually reduces the cost to serve customers from what it was previously. Unhappy customers are expensive — being, for example, more likely to return products or more likely to require support. Systematically solve the source of dissatisfaction, you don’t just make them more likely to return — you reduce the amount they cost you to serve.”

Read the entire article: The Value of the Customer Experience, Quantified

Faithie Robertson has a solution for the NAV 2013 R2 bug regarding rendering the wrong caption on report fields:

[see the description of the bug in the ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 11]

We finally got our fix from Microsoft on this one today.

To resolve the issue we have to:

  • CUT the fields that are messed up from the page.
  • Close and compile the page.
  • Reopen the page and paste the fields back in.
  • Compile the page.

There's some sort of strange magic to the cut/paste part of the solution. You can remove the fields and re-add them from the field list of the table all day long and all you'll get is frustrated. But if you cut and paste - you're golden! I don't know if they'll pursue a hotfix on this or not, but if you see the issue - this seems to be the only way to fix it, as goofy as it is.

Kyle Hardin added to the discussion on using the Microsoft Dynamics NAV Application Profiler:

[see Dan's original post on the NAVAppProfiler in the ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 10]

Dan [Sass] posted a couple of weeks ago about the NAVAppProfiler for Dynamics NAV 2013 that does what Code Coverage used to do. Today, I tried it in battle.

The MSDN article that Dan posted, Introducing the Microsoft Dynamics NAV Application Profiler, is good, and there are links to downloading the Add-On and a video (about 7 minutes long) on how to set it up and start using it.

However, the video leaves out an important step.

The Add-On that the NST runs is a DLL that hooks into the performance counters of Windows. When I tried to run it from RTC, I got this error:

Error Starting ETW: Access Denied (Administrator rights required to start ETW)

The trick is to add the service account that the NST is using to the local administrators group on the service tier server, and then restart the NST.

Important safety tip: This will not work with NAV 2013. The config XML file for the NST adds a new key called EnableFullALFunctionTracing in 2013 R2, and that isn't present in 2013. I even tried adding it by hand, but it still doesn't work.

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 14

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 14

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Michael Heydasch on anomalies with the Job Queue and NAS in NAV 2013:

I've experienced many anomalies w/the Job Queue and the NASes on NAV version 2013, leading me to believe the NASes are not as stable on the 64-bit service tier as the older NASes. Microsoft has been involved almost from the get-go. We've separated the NASes into dedicated service tier instances, created one instance for each job, etc. For months I was restarting the NASes overnight...turns out MS has acknowledged the NET STOP and NET START via the AT scheduler is not ideal for restarting the NASes. They provided a PowerShell script. Attached find the Word doc containing the script.

NOTE: The Restart-Service line had to be revised to:

Restart-Service $ServiceName.Name

[Attach Word doc]

Alan Campbell on Agile Design vs. Waterfall Design

BDUF stands for Big Design Up Front. It is what’s known in the waterfall world as the “Design Phase” – a period of time that can last anywhere from a couple of weeks to a couple of months where designers can take the project’s requirements and ideate, at length, over how the solution will manifest in interactions and aesthetics. Designers will typically explore various workflow options, data collection tactics alongside aesthetic, layout, and typographical treatments. Even with the addition of a Sprint 0, which allows designers one sprint to get “ahead” of the development team, BDUF vanishes. Designers new to Agile will protest that they are not given enough time to think about the solution and that in no way can they turn around a design in the given timeframe. This resistance alone can quickly kill the momentum of an Agile team.

To understand how to resolve this issue, we need to examine its root causes first. BDUF allows designers time to think about the entire experience the team is building. The expectation is that at the end of the design phase, the entire product is designed and spec’ed out. In addition, this is typically the first and last time the designer will get to spend a significant amount of time on the project so everything must also be right as there’s no (significant) going back.

When introducing Agile to designers, it is imperative to stress that they focus on only a sprint’s worth of design work. In fact, they should hesitate to design too far “ahead” of the development team as priorities may shift after each incremental release and that additional work may go unused. Focusing on a sprint’s worth of work dramatically reduces the workload for the designer. All of a sudden, turning around a much smaller amount of design work becomes much more realistic in the given timeframe.

Second, Agile is iterative. There will be another sprint and it will provide another opportunity to refine and build on the work currently being implemented. The waterfall designer’s mindset doesn’t expect that. The expectation is that the work will be launched never to be touched again. By convincing your designer that this is the first iteration of the implementation, that learnings will be collected and that subsequent iterations will give her opportunities to update, improve and resolve the UX you begin to alleviate the concern that a less-than-finished piece of design is released to customers.

Read more: Top 3 Reasons Designers Object to Agile and How to Overcome Them
http://www.rallydev.com/community/agile/top-3-reasons-designers-object-agile-and-how-overcome-them#

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 15

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 14

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Jon Long on standard practices for upgrades:

Three topics that can raise blood pressures in non-upgrade circles are Dev License, Data Loss, and Code Comments.

Dev License – The Dev License is widely used in and upgrade on the client’s server. Normally, it might not be best practice to save the DEV license or "upload" the Dev license to a client’s db. Certainly not so in an upgrade. The Data Migration requires it.

Data Loss – The "Prevent data loss from table changes" property defaults to <Yes> every time you log into NAV. It is widely advised to NEVER set it to NO. Well, that's pretty silly when you’re doing upgrades. In upgrades, that property is your friend. You spend a great deal of time working on a database that has no data in it. And, when it comes time to do a data migration, there is data that you actually want to delete. It will delete all the values in fields that were deleted (in an Add-On that was removed, for instance). That can be quite a time saver. You don't have to run custom delete code. Also, my research suggests that the future of the one step Data Migration functionality will allow us to PS script the handling of data in a variety of ways, essentially giving us the control to delete(default), move, or even parse.

Code Comments – in upgrades tend to stray from the norm. I'm not going to say anymore on this subject here other than to say that an upgrade presents an opportunity to make the code better than it was. If the commented out code is not auto-merged by the tool, it will be left as is. But, if it's involved in a conflict and has to be manually merged, developers should remove commented out code. There are many exceptions and there are no rules per se.

Alan Campbell on Risk Neutrality:

Risk Neutrality: This is a post by the author of "just give me a number". Read it you will like it, especially sales people. I like the following paragraph, which forms the basis for our Agile approach:

"Even when one is in the happy situation of choosing between alternatives with positive values, businesses often yield sub-optimal results by applying their risk tolerances at the project level. The natural human desire to stamp out all risk leads many companies to enact arbitrary thresholds for projects to meet (e.g., no more than a 15% probability of losing money). They will spend millions of dollars to acquire information (imperfect information, I might add), which may reduce the probability of loss from, say, 18% to 13%, thereby crossing the magic, completely arbitrary threshold. This is a waste of their shareholders’ money."

Read the entire article, Risk Tolerance and Risk Neutrality (You Can Live with More Risk than You Think)

Dan Sass posted a link on Lessons for First-Time CEOs:

Excerpt:

Whether you are a first-time leader or a first-time CEO, the basics apply:

  • Keep in mind that leading is different from managing
  • Pay attention to transitions, getting a head start, managing your message, building your team
  • Focus on the cause – it’s about inspiring and enabling others

Read the entire post: Lessons for First-Time CEOs from Medifast’s Mike MacDonald.

Dan Sass posted a link on the traits of indispensable employees:

Want employees who are competent and hard-working and truly care? Here’s what to seek out and nurture:

  • Fire in the belly
  • Smat works
  • Empathy is your friend
  • Integrity is integral
  • All for all

Read the entire post, 6 Magic Traits of Indispensable Employees.

Blog Tags:

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 16

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 16

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Dan Sass posted a link on leadership:

5 Hard Truths about Leadership that You Never Stop Learning

Excerpt:

So what are some hard truths about leadership?

  • It ain’t easy
  • Leadership isn’t management
  • You can’t do it all
  • Know how to communicate
  • You are what you do

Rick Dill on Sales Campaign Discounts:

Campaigns use NAV's "Best Price Rule" logic, which means that it treats Campaigns as another price option for that customer. In NAV, a customer may qualify for more than one price in the price list, and NAV finds the "Lowest" price and populates the order with the lowest price.

So, the campaign price would not be an additional price off of list, but would calculate a price and use the campaign price if it is the lowest of the possible prices.

Kyle Hardin on opening the Sales List Archive in Microsoft Dynamics NAV:

Learned the hard way. I couldn't figure out why the page Sales List Archive wouldn't open an archived Sales Order when you double-clicked on one in the list. Posted Sales Shipments work correctly, why not the archive list?

After some careful side-by-side comparison, I found the Page property that makes it work:

CardFormID

Set that to the Card page you want to open when the double-click happens.

Here's a little fun:

Does this sound like your organization? Let’s hope not!

The Expert

Blog Tags:

My Very Own Life Hack

$
0
0

My Very Own Life Hack

Faithie Robertson discusses using creativity in everyday life as well as on the jobSo there I was, sitting in the airport, and I realized I had created my very own life hack.

Once every two to three years, ArcherPoint hosts a companywide event called Fast Forward. During the three days we’re together, we unplug from databases and projects and reconnect with each other. We have sessions about company culture, company changes, and we break out for activities within our own departmental sessions. We spend a great deal of time getting to know each other, which is vital since so many of us work from home and don’t make face-to-face contact with the majority of the company otherwise.

But we actually do more than that. There’s something that happens without planning, and when you least expect it. Free from the monotony of the same-chair-same-desk-same-laptop view of the job, free from the stress of the hours we put in and the issues we solve, we go through a sort of—“detox”—for lack of a better word.

Sitting around the table on the last day, a few of us were talking about vacations, and one of my fellow developers, Michael Heydasch, said to me, “Don’t you find it takes a few days to just download a relax into a vacation?” I confessed that yes, it does, and it’s when I start having dreams again that I realize I’ve finally relaxed. I also told him that I don’t dream often, and really haven’t in a long time. His eyes perked, and he told me something I didn’t know: “Faithie, do you know that dreaming is necessary for your mind to relax?” The light bulb came on! That certainly fit what I’d been going through recently with foggy thoughts and bad memory. Little did I know it was a symptom of a greater problem regarding getting sleep and how much our brains need sleep for learning and creativity (If you’d like more information on dreaming and how sleep affects your brain power, check out the article, Brain Basics: Understanding Sleep).

Flash back to a discussion I had with another one of my fellow developers, Rita DeVrieze, at the conference over lunch. She mentioned that in her home office she has a desk behind her with an assortment of things like buttons, a hot glue gun, paint, and so forth, and she takes a creativity break when she reaches an obstacle. It’s a proven fact that our ability to think is related to having a creative outlet (to learn more, read about the neuroscience of creativity or about how you can find your own creativity in one of Rita’s favorite books on the subject). Considering that developing code is, in fact, a very creative process, I found that intriguing.

I personally keep a wooden basket of twisty toys, crayons, and blocks on my desk. I do this because I found out I was a kinesthetic learner, meaning I have to have motion and touch to allow myself to absorb what I’m hearing or what I’m reading sometimes. You’ll find people like me sitting in meetings clicking the top of an ink pen – unless they have these kinds of quiet things to fiddle with at their disposal. Since the sound of a clicking pen tends to annoy some people (you know who you are!), I just twist my little tangle toys, stack my twist and lock blocks, or color with my crayons during conference calls and meetings so I can keep my focus level up.

Creativity is such an important part of what a developer does, yet we often ignore the fact that our creativity can be diminished by simply doing too much thinking. I confess there are days when by 5 o’clock I have to put thought into it to simply give my full name! I often have dinner sitting in silence and staring out the window just to shut down the neurons that have been feeding processes and database triggers and codeunit calls all day long.

We need sleep with dreams to rejuvenate our minds, and we need creative outlets to use the parts of our brain that help us to think outside the box and take our software application designs to a higher level. For more information on how creativity affects out thinking, check out this TED talk by Elizabeth Gilbert, author of “Eat, Pray, Love.” She talks about the need to unleash your own creative genius, something we all have yet don’t exercise.

Flash forward to the airport. I checked in my bag for the trip home after our company wide meeting. I grabbed a soda, a cup of fries and a handful of ketchup from Boardwalk Burgers in the Atlanta International Airport knowing my next food opportunity wouldn’t be for five more hours. (I do not miss food opportunities!) Sitting at the gate, I was faced with the age old issue of how to eat fries with tiny pouches of ketchup.

If I had to squeeze the pouch onto each fry, that would take time and precision to ensure it didn’t drip on my shirt. If I drizzled it on them in the cup, I’d eventually have it all over my fingers. The napkin was far too thin for something runny like ketchup not to leak through. And, of course, going without ketchup (or salt) is NEVER an option! Suddenly, I felt the bottom of the cup, and I realized I had a very simple solution.

I took the cup of fries out of the bag and emptied the fries down into the bag. Using the lip at the bottom of the cup they were served in, I had the perfect spot to squeeze out the ketchup into something like a mini sauce cup, and dip my fries – without getting it all over my hands. I’d created my very own life hack! My brain was functioning… and functioning creatively!

That night, something else occurred! I DREAMED! For the first time in months, I had a dream. Now, I will not share the dream for fear of the men in white coats coming for a visit, but regardless, I knew my mind had gotten the rest it needed from the stress of the everyday life of a mother, wife, and software developer.

We are all so intrinsically different in how we look, walk, talk, and think. But we are all bound by the fact that we have our limits. The average human only uses 10% of their brain. Geez, I don’t know about you, but if I’m going to pack this mass around in my head like excess baggage and have it show up on the scales, I want to make the most of it! After all…it’s my money maker, baby! As a developer, I think for a living!

Flashback (again) to the first day of this year’s Fast Forward conference: I was honored to be awarded the company’s first “Delighting Clients” award, which represents one of ArcherPoint’s core values. I was humbled looking around the room at the faces of our company because it was awarded to me by my peers, a group of people I highly respect for their creativity, wonderful personalities, and unique abilities. When I accepted the award, our CEO, Greg Kaupp, asked me to say something to the group. GULP! I was not prepared! But what I did say remains true. I am a product of the team of great people I work with. The realization I had of why I had just created my little ketchup cup life hack was due to what Michael and Rita had told me just in a passing moment of conversation. Sometimes we grow from each other without even recognizing it.

Fellow developers, take some time to detox, unplug from the desktop, walk away from the glare of the monitors. You just might find that when you return, you are better equipped to do the job you are tasked to do. Dreams return, creativity returns, and you just might edge that 10% of brain mass in use to 11%.

For more information or assistance with NAV development, read more ArcherPoint developer blogs or contact ArcherPoint.

Blog Tags:

The Importance of Version Tags in Dynamics NAV Objects

$
0
0

Black Dog Serenade: The Importance of Version Tags in Dynamics NAV Objects

Every object in Microsoft Dynamics NAV (Navision) has a version tag. You’ve probably seen them in the Object Designer; they look kind of like this:

NAVW17.00.00.35026,NAVNA7.00.00.35026,JM7.0.18,SE0.55.12,AP7.00.006

That one comes from the Sales Header table for a customer running NAV 2013 who has several add-ons and customizations installed. It’s awfully long, isn’t it? I’ll try to break it down and explain what these all mean.

You’ll notice that there are several commas in there. The general rule of NAV development is that every group of people that touches an object leaves its own stamp on it in the version tag, and the tags are separated by commas.

The first part of the tag is “NAVW17.00.00.35026.” The “NAVW1” denotes that this object was modified by the core NAV development team. The “7.00.00” part denotes that this object was last modified as a part of the NAV 2013 initial release. Objects modified for NAV 2013 R2 are tagged as “7.10.00,” and objects modified for NAV 2009 R2 are tagged as “6.00.10;” the core team conforms to the standard major.minor.more minor format generally used in software development to denote releases. The “.35026” marks that this object has been touched by one of the hotfixes that Microsoft releases periodically; those are all marked chronologically so that we can tell what’s been applied. Every object in the base NAV system has a “NAVW1” tag telling you when it was last touched by the core development team.

The next part of the tag is “NAVNA7.00.00.35026.” The “NAVNA” denotes that this object was touched by the North American localization team. (Other regions have their own tags; feel free to get a whole bunch of different localizations of NAV together and play Localization Team Tag Bingo.) Again, the “7.00.00” tag tells us that it was modified for the 2013 release of NAV, and the “.35026” tells us that the object was changed as a part of a hotfix. The North American localization team (and presumably the others as well) use the same major.minor.more minor versioning format as the core team to denote release changes.

The “JM7.0.18,SE0.55.12”section of the tag is used to denote that two different add-ons have touched this object. This particular customer is using Cost Control Software’s Job Manager add-on (the “JM7.0.18” tag) and also Lanham and Associates’ E-Ship add-on (the “SE0.55.12” tag). Since there were two different add-ons for this customer, the code changes had to be merged. I was the developer who did the merging of the code, and so I had to decide which tag went first and which tag went second. (and for a few objects, third; this is a customer with a lot of add-ons running together). The important thing here is that I needed to be consistent with which add-on tag came first, then second, then third, and fourth, etc. There’s no rule for determining which add-on wins and has its tag go first.

The last part of the version tag is “AP7.00.006.” This is the ArcherPoint tag, meaning that we changed the object per a customer request, and they’ve approved the changes for use in production. The “AP” is our initials, and the “7.00” is the version of NAV we’re working with. The “.006” means that this was changed in our sixth release for the customer, not the sixth modification we’ve made to the object. (We do make notes in the Documentation trigger of the object for each change we make to the object, but those are the subject of a different blog entry.) In my time in the field, I’ve seen other NAV consultancies use similar tags for their changes. When we come across them, standard ArcherPoint policy is to try to leave them intact and append our tag to the end of the object if possible.

I will also tag objects that I’m working on for an unreleased project by appending my initials and something else to the version tag. If I’m modifying the object as part of a support ticket, I try to use the number from our internal ticketing system, like “TH1234,” and if I’m modifying it for a project, I try to use the number of the task from our project management system, like “TH12345.” If I’m working on the same object for multiple customer requests, I add a tag for each request; it helps me track which objects belong to what project, and it lets me know that I may have to de-merge some code from project B to get the object moved into a testing environment for project A.

Sometimes, we run out of space in version tags. This happens more often now than it used to, since Microsoft started adding six-character hotfix numbers to the worldwide release tag and to the localization release tag. When this happens, we try to keep the tags as intact as possible. The first things to go are the tags from other consultancies, assuming that they’re not still working with the customer. The next things to go are the commas that separate the individual pieces of the tag. After that, we have some hard choices about what to drop; we’re still hashing that out internally.

So, that’s an explanation of what the object tags mean and how they are used. Hopefully you can use it to understand what’s been done to an object.

For more information or assistance with NAV development, read more ArcherPoint developer blogs or contact ArcherPoint.

SPECIAL STREET FIGHTER UPDATE: I didn’t get to go to Las Vegas for the Evo Street Fighter IV championships, but I did at least watch it streamed online with some friends. Watching Luffy win the tournament with his Rose has encouraged me to start experimenting with Rose myself; I’ll see what I can do with her. Normally, I main Blanka, so I like how Rose has some gimmicky stuff with Ultra 2 and her fireball reflection/absorption. I also like having a relatively easy super cancel from Soul Spiral; maybe Rose will end up as my go-to alternate character.


ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 17

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 17

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Question regarding using Excel with Dynamics NAV:

Is there a way to send documents (sales orders) to Excel? This works fine on those machines with Excel 2013 installed. However, those machines with Excel 2003 have the send to Excel grayed out. Doesn't NAV 2013 work with Excel 2003?

Answer:

NAV 2013 only works with Office 2007 SP1 and up. 2013R2 requires Office 2010 or newer.

Dan Sass shared a link:

Importing and Exporting Data in Microsoft Dynamics NAV 2013 R2 CU 8

Excerpt:

In earlier versions of Microsoft Dynamics NAV, you could move or copy all or part of the data in a database by using the Microsoft Dynamics NAV backup functionality. In Microsoft Dynamics NAV 2013 R2, the support for the .fbk files was removed, but with Cumulative Update 8 for Microsoft Dynamics NAV 2013 R2, we introduce Windows PowerShell cmdlets so you can export data from a Microsoft Dynamics NAV database and import it into another Microsoft Dynamics NAV database. You can also export and import data in the Microsoft Dynamics NAV Windows client.

Ashok Sundaram added:

Run Pages 9900 - Import Data and 9901 - Export Data.

No shortcuts on Role Center.

Question regarding Job Queue:

Has anybody tried to post a journal silently and automatically with Job Queue? It looks like I am going to have to go through cu12 and cu13 to suppress all of the user interface dialogs and messages.

Nitin Patil:

Codeunit messages should be blocked using GUIALLOWED wherever applicable. Found some information about calling codeunits and handling errors/messages here:

Job Queue Example in Microsoft Dynamics NAV 5.0

Daniel Parker:

You may need to use code coverage to get any outliers. Like Nitin mentioned, everything else gets a guiallowed wrapper. Also confirm windows are not allowed.

Nitin Patil:

1) GETLASTERRORTEXT will be helpful to get latest error for exception handling.

2) Are you going to roll back the journal if there is an error while posting? If not, then try to post entries that have no issues calling 1 line Post JNL at a time. IF Codeunit.RUN fails and returns Error, you may log it into some exception table and continue posting rest of the journal. Clients always prefer to minimize number of attempts they may try to post all transactions in journal until all errors are handled.

Item Journals has common exceptions, like 0 Inventory on hand , blocked Item, missing Posting Groups, missing dimensions in Item Journal Lines etc. You may create scenarios and run through code coverage for messages, then add GUIALLOWED wherever applicable.

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 18

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 18

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Question: I am working on an upgrade where there have been a few issues with SQL Server versions and collations that appear to be resolved. Now we are seeing some issues around creating an ADO connection. It appears to me there may be a network security setting that is causing the user to answer prompts to "allow access from this site" every time the code tries to launch the SQL Server stored procedure.

There are no file related commands. The stored procedures are reading views from one server/database and inserting rows into a table on a second server/database. All stored procs run fine from SSMS so we know they are good. I think it has to be something related to permissions or network security. All linked servers are accessible from SSMS.

We have fixed the issue around the connection timeout error. We are now seeing an issue with using the ADO connection and running the stored procedure. I have spotted some blogs stating that you cannot use ‘Microsoft ActiveX Data Objects 2.8 Library’ in RTC. I am going to try the new DotNet datatype to see what happens. If anyone has used this method in 2013 R2 shoot me a message. Thanks.

Nitin Patil replied:

Do any of these stored procedures have flat file copy or creation code?

If yes, then try changing the folder path to something easily accessible (i.e. NAV server folder) instead of remote or SAN based folders.

Owen McDonald:

I'm using ADO in Dynamics NAV 2013 and haven't tried R2 yet. They must run on the client side obviously. As far the DotNet data type, NAV's own data migration toll uses this approach.

Question: I have a requirement to call a SQL procedure from Navision, capture the dataset, and store that into a Navision table. Has anyone done something similar? Is it possible to do? This is for Navision version 4.00.

Kyle Hardin:

Yes, this is possible. In 4.0, you'll be limited to calling ADO as an Automation or OCX variable. And you won't be able to directly store the results into a NAV table, but you have two options there.

First, you can do it the hard way. Loop through the resulting SQL dataset record by record, and copy that into your NAV table field by field.

Second, you can have the SQL procedure store the data into the NAV table directly - however, this will bypass any and all NAV table triggers.

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 19

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 19

In this blog post I’d like to discuss whitespace.

Not the graphic designer’s whitespace, where the lack of text and images draws attention to the designer’s message. Rather, I’m talking the white spaces (or hidden characters) in text files.

Most developers are familiar with ASCII text (ASCII stands for the American Standard Code for Information Interchange), and it’s the standard used in all text files – although not always in a standard way.

To understand some of the issues, realize that the ASCII standard had its beginnings back in the early 1960s, when computers were huge and expensive and the “latest” office tool was an electric typewriter (much better than those manual typewriters that fewer and fewer people remember actually using).

You see, back then the typewriters were limited in what they could print. For instance, to underline some text, you would type the text, then backspace and overprint the text with the underscore character. Then there was a lever on the side that would let you skip down a line and continue typing wherever the typewriter head was at on the page. To begin a new line, you would push the lever all the way back, a bell would ring, indicating that the carriage had returned to the starting position so you could start your next line of text from the left margin.

Obviously, if you wanted a space or a tab, you would just hit the space or tab key.

Olivetti typewriter image by Dennis van Zuijlekom

 

Electric typewriters worked the same way, and when the “new” teletypes came along, they needed a way to do everything the typewriters were doing. Hence, we have ASCII characters for spaces and tabs, but also for backspaces (BS), line feeds (LF), carriage returns (CR), bells (BEL), and several other “non-printable” characters (non-printable because you don’t “print” a space or bell).

A while back, I was developing software for the wireless telephone system. Our group was responsible for validating the caller, another group was responsible for the networking and switching, and still another group was responsible for settling the bill among the various wireless carriers that were involved in the call (if a person from New York is roaming in San Francisco, which phone company gets which part of the bill?).

Our group used UNIX systems, the billing group used Windows. Everything was working just fine until we were asked at one point to provide billing records for one of the services we provided. We set up the system to automatically send the billing group their information in the specified format at the specified time…and then everything went crazy. The billing reports were a mess and didn’t make sense. And let me tell you, when half the country’s wireless providers don’t get their billing information on time, it is not pretty.

We went over the specifications and everything matched – we looked at the data from our side and it looked good, but when they received the data from us, there was something wrong. Yet we showed we were sending and receiving just fine. So what happened?

It turns out, the problem we were having was with the way the various operating systems chose to implement the ASCII standard for text files…specifically, how they chose to implement a new line. “A new line is a new line, isn’t it?” or so we thought.

We finally sat down and looked at the binary data on both sides and saw the problem.

DOS, and subsequently Windows, chose to follow the typewriter method of issuing a carriage return followed by a line feed (“CR/LF”, or “\r\n” if you’re using escape characters). UNIX decided to simply issue a line feed, while early Apple Macs used only a carriage return.

This is why, if you’re on a Windows machine and you download and open a text file from a UNIX platform, you might open it up in your text editor and see one, long line of characters and spaces. The Windows machine never sees the carriage return it is expecting and just prints the characters one after the other.

Conversely, if you’re on a UNIX machine and you download a text file from a Windows platform, you get some strange characters at the end of each line, typically looking like ^M, which is the carriage return it is NOT expecting.

There are tools to handle this situation for both platforms. One of the most common is to FTP the text file to your local machine as ASCII text (make sure it’s a text file, though, and not binary data!). FTP will format the text for the native platform, so you won’t have to fix it later.

Some text editors and code writing tools will automatically interpret it correctly, or prompt you for how you want the text to be displayed.

To make a short story long, it is necessary to be aware of cross-platform issues and understand that not all text files are created equally (or, at least, the same way).

Blog Tags:

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 20

$
0
0

ArcherPoint Weekly Microsoft Dynamics NAV Developer Digest – vol 20

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Alan Campbell shared a link: 

TechWell | Stop being Difficult! How to Deal with Passive Aggressive Stakeholders

Everyone who has been on a development project has seen them – difficult stakeholders that seem to undermine the team’s progress. This problem can be distracting to downright destructive. This article offers advice on how to keep passive-aggressive stakeholders engaged so that the project can continue without incident.

As a developer, our team often had difficulties working with other departments, like marketing and project management. This article gives some non-confrontational advice I wish I had known about before.

Question about using Report Builder:

I need to modify some invoices. The client is on 2013 R2 but only has Visual Studio 2010. I need to make some minor changes could probably get by using the Report Builder but I get this error message when trying to compile a report or open the designer. This is even when I have report builder set to YES under the options:

"Could not load file or assembly 'Microsoft.Dynamics.Nav.DotNetBridge, Version=7.1.0.0' 'system cannot find the file specified'

I can modify the reports locally - I tested this and imported to the client and report ran fine, but it would be nice to do this on the customer DB.

Has anyone run into this before? any suggestions?

Answer:

Are you running the client from the c:\program files (x86) folder which is for 32 bit applications ? If not try running the dev client from here.

I've seen this error when folks are using the dev client from the c:\program files folder which is for 64-bit applications. The DLL is not installed there.

Question regarding how to show company information

In RTC, how do I make it show the server and database and company in the upper right corner? I think I have seen this under the Search box, but I don't know how to turn that on.

Answer:

Go to the Company Information, System Indicator fasttab. There are a couple of options related to how it's controlled.

Faithie Robertson commented on Object Manager:

Object Manager's Where-Used functionality saves the day again. Not only can we use it when we need to see where a specific field is used, but we can see when they're not used at all. Today I had to put functionality on a custom sales document. Copying the fields used from the Sales Header to this document's table, I worried I had things that weren't needed. After running Object Manager's where used I was able to cut 7 fields out! SWEET!

Helle Madsen replied:

During the upgrade to NAV2015, I discovered another option for where-used analysis, which might apply to earlier versions too – it's using the system table called Field (table 2,000,000,041).

In my scenario, when I filter on RelationTableNo=2000000120 and RelationFieldNo=2, I get a list of all tables that are related to the "User Name" field in the User table. It shows the field definitions too, in case a field needs to be expanded.

This functionality is used by the upgrade toolkit (and cu418 User Management) because the Windows login needs to be converted to users due to all the new options for authenticating logins.

Blog Tags:

Try This One Weird Old Trick to Write NAV Records!

$
0
0

Try This One Weird Old Trick to Write NAV Records!

I understand that this is a trick that “they” don’t want you to know about, and I’ve heard that it cuts down a bit of your belly fat each day. I’m not sure who “they” are, and I certainly haven’t noticed any reduction in my own belly fat, but that’s still what I’ve heard.

Anyway, this is a trick I’ve been using for a while, probably since shortly after I started working with Microsoft Dynamics NAV (Navision) by pulling in lots of data from a legacy system via big dataports.

Sometimes when you’re writing records to NAV, you get an error message saying, “The record does not exist. [Primary key fields here]”. This is an error you get when things are coded to do a MODIFY on a record that hasn’t actually been written to the database yet. I thought of this because it actually happened the other day; a customer called me because their sales order import wasn’t working, running into this issue.

The rule I use ensures this error never comes up. But everyone doesn’t know about the rule, so I’m writing a blog entry about it to tell the whole world.

What’s the secret? It’s pretty simple, really. I generally start record writes with a RESET and then an INIT, and then I set the primary key fields. Remember that INIT doesn’t actually alter primary key values, so you have to blank those manually. Once I’ve got a good, empty record, I then set the primary key fields. And here’s the trick: Rather than setting the other fields, I do my INSERT operation immediately after I write the primary key fields.

After I’ve done the INSERT with the primary keys, I then write the remaining fields of the record by calling [record].VALIDATE([fieldname],[value]. I always try to call the validation triggers, even if there’s no code in them, because someone might add the code later. I will write the field directly without the validation logic if it blows up, though; this tends to be the exception rather than the rule.

When I’ve finished writing all of my fields, I finish up with a MODIFY operation to update the database.

If I’m working with a No. Series that’s setting a primary key field, then I generally want the field I’m setting via No. Series to be empty and then I run the INSERT operation with a TRUE parameter, since the appropriate No. Series is nearly always called during the OnInsert trigger. In the event that I can’t call the OnInsert trigger for some reason, I can get the next value from the No. Series by using the NoSeriesManagement codeunit.

The good thing about using this method is that even if there’s a MODIFY somewhere in the OnValidate logic, it won’t blow up on me. Also, it means that if some programmer in the future adds a MODIFY to an OnValidate trigger later, the write operations I’ve put in place will still work properly.

About the only time I wouldn’t recommend doing this is when you have a huge set of records to write, and transaction speed is paramount. But those scenarios tend to be the exception, rather than the rule.

So, next time you’re writing records, try this trick and see if it doesn’t work out for you. Happy NAV coding!

For more information or assistance with NAV development, read more ArcherPoint developer blogs or contact ArcherPoint.

Blog Tags:

ArcherPoint Microsoft Dynamics NAV Developer Digest – vol 21

$
0
0

ArcherPoint Developer Digest – vol 21

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Jon Long on a potential bug with running 1099 reports using Dynamics NAV 2013 and NAV 2015:

Any client who is on Dynamics NAV 2013 thru Dynamics NAV 2015 should test their 1099 information (Report 10110 "Vendor 1099 Information"). It should match their old system (pre-Dynamics NAV 2013).

Run any of the 1099 reports and they have peculiar calculation issues. When you run the reports in pre-NAV2013R2, then run them in 2013 or above, you might get different numbers. In one example, the 2013R2 version showed payments significantly more than running the same reports in a pre-NAV2013R2 version. There are zero customizations involved and the reports are virtually unchanged from old to new versions.

I think this bug was introduced around 2013 rollup 7, but haven't vetted that out yet.

I've fixed this issue temporarily by simply rolling back the function in Codeunit 10202 "Entry Application Management". The function that has changed and is causing the issue is called GetAppliedVendEntries. It appears that changes were made for performance reasons. No business logic should have occurred. There is no logical reason that the numbers should be different. I've researched all Rollups through the initial release of 2015. It appears that this issue still exists in 2015, but I haven't tested this yet – I just compared the code. The issue seems to affect only certain vendors, perhaps due to only certain scenarios. For instance, some vendor totals were correct. On a few that were incorrect that I analyzed, one contained voids, which were not handled properly in the new code, and one had several payments which were paying for invoices from 2 years prior, so that was odd, but not handled by the new code in the same way it was handled in the old code.

I've submitted a ticket to Microsoft and will report their response here when I get it.

Update from Microsoft:

No official fix yet. The workaround outlined above is the only option at this point (i.e., roll back Codeunit 10202 to 2013 Rollup0 version.) It looks like an inadvertent change was added to Codeunit 10202 that was meant for a non-North American version. That Codeunit has only 2 functions, GetAppliedVendEntries and GetAppliedCustEntries. They both have potential bugs in them. These functions are not just called for 1099 info, so this bug may cause discrepancies in many areas of NAV. This workaround is a must for any company that uses Vendors.

Here's an interim piece of code I produced while Microsoft sorts this out.

NOTE: This code is only provided as a tool for testing and was not produced by Microsoft nor is it meant to fix the problem on production systems.

You can import this fob into all 2013, 2013R2, and 2015 db's and use it to test whether or not your system is affected. It replaces Codeunit 10202. I only replaced the function GetAppliedVendEntries with an older version from NAV 2013. You can use it to run the report and do a compare of the totals before deciding whether or not to go ahead with additional development by modifying that function in your own NAV system. If so, keep an eye open for Microsoft updates that fix this problem.

So far, all the clients I've tested have inflated 1099 numbers, the worst being $250K over 8 months. Customer Ledger balances are not affected.

Dan Sass shared a link on Microsoft Dynamics NAV 2015:

Importing and Exporting Data in Microsoft Dynamics NAV 2015

With the release of Microsoft Dynamics NAV 2015 last month, this article provides useful information about moving data between NAV databases.

Exerpt:

In earlier versions of Microsoft Dynamics NAV, you could move or copy all or part of the data in a database by using the Microsoft Dynamics NAV backup functionality. In Microsoft Dynamics NAV 2013 R2, the support for the .fbk files was removed, but in Cumulative Update 8 for Microsoft Dynamics NAV 2013 R2, we introduced Windows PowerShell cmdlets so you can export data from a Microsoft Dynamics NAV database and import it into another Microsoft Dynamics NAV database. You can also export and import data in the Microsoft Dynamics NAV Windows client. This functionality is also included in Microsoft Dynamics NAV 2015.

You can export and import a single company or all companies in a database, and you can export and import other types of data such as global data, application data, and application objects. When you export data from a Microsoft Dynamics NAV database, the data is stored in a file with the extension .navdata, which is a new file format that is proprietary to Microsoft Dynamics NAV data. You cannot edit the .navdata files in other tools.

Dan Sass offered an interesting link on handling your personal success:

The Unexpected Consequences of Success

It’s one thing to handle failure in your life, but how you handle personal success is just as important. This article brings up some interesting points, such as how to handle talking about your success to others and how to shift the focus of the success away from yourself and to the community. It can make a real difference in how your colleagues react to your good fortune.

For more information or assistance with NAV development, read more ArcherPoint developer blogs or contact ArcherPoint.

Blog Tags:

Customizing Drop-Down Lists for Tables in the NAV Role-Tailored Client

$
0
0

Alternate Costume Pack:Customizing Drop-Down Lists for Tables in the NAV Role-Tailored Client

Back in the days of the legacy client, doing lookups into another table for a foreign key field in Microsoft Dynamics NAV (Navision) always involved running a list form.

Nowadays, if you try to do a lookup into a table for a foreign key, you get something like this (Customize DropDown List for a table found in View – Field Groups – DropDown group):

Lookup into the Sell-to Customer No. on a New Sales Order with a drop down list displayed.

Figure 1 – Lookup into the Sell-to Customer No. on a New Sales Order with a drop down list displayed.

On a semi-regular basis, I have customers look at this drop down list and decide that they need some extra fields added. Back in the day when everything was done with a list form, this involved adding a new field to the list. But if you get into the code for the Sales Header table and look at the OnLookup trigger for Sell-to Customer No., you won’t see any code that’s running a list form.

You might go look at the Customer  table and notice that it has a LookupFormID property assigned to the Customer List page. But take a look at those fields on the drop down list above—those are not the fields from the Customer List, are they? And if you try editing the Customer List page, the changes you make are not reflected in the drop down list at all.

The actual way you edit this is hidden in the FieldGroups for the table. You can access it in the development environment by going to the View menu and choosing Field Groups. (It’s right under the “Keys” option.)

Customer Table -> Field Groups.

Figure 2 – Customer Table -> Field Groups.

All you have to do to add a field to the drop down list for the table is add something to the Field Group labeled “DropDown.” For example, if I wanted to add “Address” to my customer lookup, I would do this:

Figure 3 – Customer Table -> Field Groups with code for adding “Address” to customer lookup.

And then my drop down list looks like this:

Sell-To Customer No. drop down with address added.

Figure 4 – Sell-To Customer No. drop down with address added.

That’s all you have to do. Note that if you want to filter on the field in the drop down list, you also need to add it as a key to the table.

It’s not the most intuitive thing in the NAV development world, but it’s easy once you know how—sort of like doing 360 motions in Street Fighter for those big command throws with Zangief. (The secret there is to buffer them with something that takes enough time that you can finish the up parts of the motion without jumping inadvertently, so you can jump in and do the top part of the circle while you’re jumping, or you can start a dash and use the time while you’re moving forward to put the top part of the circle in, or you can even do a move and put the motion in while the animation for the move is completing.)

Be sure to read more ArcherPoint developer blogs. If you have any further questions about customizing in NAV, please feel free to contact any of the NAV experts at ArcherPoint. (Please direct all Street Fighter questions directly to Tom Hunt.)

Blog Tags:


ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 22

$
0
0

ArcherPoint Developer Digest – vol 22

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Problem with NAV printing to a PDF printer:

Question: Has anyone encountered this before?

I know that this might not necessarily be a NAV issue, but the issue only occurs in NAV. We have an Adobe PDF printer on our terminal servers. Periodically, users will get a NAV  error, “You have selected the wrong instance of this printer.” This issue is not easily reproducible, but when it occurs, it really holds thing up. They only thing that seems to fix it is selecting and reselecting the printer before NAV finally allows it to print to PDF. I have done a little Googling on this issue and it seems to only happen on terminal servers.

Reply: "instance" of a printer sounds like it could be a driver issue between two installs, such as NAV and Citrix.

Users receive SMTP errors:

Question: Users are trying to setup Document approvals and are getting SMTP errors. Does anyone know what could be wrong?

Answer: They need to contact their email administrator - either internal IT, or external if their email is hosted someplace other than their own server. Either a recent change has been made to the SMTP server (if this was working in the past), or this is a new user that has not been set up on their SMTP server. Questions to ask them - is it just one user, or everyone? When did this stop working? This is not something that can be fixed from NAV.

Problem with excessive growth of the Session Event table:

Problem: Need some help from anybody familiar with the Session Event table 2000000111 in NAV 2013. I discovered a problem where a web services user is recording 2-3 logon/logoff events per second and the table has grown from zero to over four million records just a few days. They are simultaneously experiencing very high CPU utilization on the SQL server and I suspect it's related, but don't really know. The external web portal is logging on and logging off 2-3 times per second through web services. I have found the setting on the NST config that will purge this table of older records, it's called Session Event Table Retain Period.

Suggested solutions:

I'm having a similar issue at a client site and suspect the growth is due to a third-party add-on. The parameter in CustomSettings.config has not had any effect. There is code on the OnDelete trigger of this table in SQL ... this must be bypassed in order to delete records without generating new ones.

Another possibility: Would web service calls be a possible culprit? I wouldn't think normal RTC connections would make the table grow much, but if each and every web service call is logged, that might do it. Is the Session Timeout property is set properly? Maybe the session timeout is a good thing to try since that should clean up the old entries.

Be sure to read more ArcherPoint developer blogs. If you have any further questions about customizing in NAV, please feel free to contact any of the NAV experts at ArcherPoint.

Timers, Single Instance Codeunits, and NAS ServiceTier on NAV 2013

$
0
0

Timers, Single Instance Codeunits, and NAS ServiceTier on Dynamics NAV 2013

 There has been a time or two in the past (on older Microsoft Dynamics NAV versions and the old Navision Application Server) when I needed an automated process that would execute faster than the minimum one minute duration afforded to me by the Job Queue. For such cases, I would use a single instance codeunit and the NAV Timer (old-style COM automation technology).

The old Navision Application Server was the Classic Client without the GUI interface. For such a situation, I’d add code to the NASHandler function in Codeunit 1 ApplicationManagement … when the NAS service was added to Windows, it would be added with the parameter that would be hard-coded in CU1 to start a single instance codeunit. Within that codeunit, the NAV Timer would be started. Thereafter, as long as the NAS was running, the timer would fire the event trigger using the specified interval.

Recently, the same need arose for NAV 2013, but because of the incompatibility between the COM Automation and the new 64-bit servicetier, I needed the DotNet equivalent. I assumed without too much verification that the NAV Timer DLL was still using COM Automation and had not been upgraded to DotNet technology. I searched Mibuso and Freddy’s blog and found client-side add-ins for a NAV Timer to be added to Page objects, but I didn’t see an example for a timer to be started in a single instance codeunit designed to be started by the NAV 2013 servicetier.

With some experimentation, I found the solution. It is assumed the reader has in-depth knowledge of NAV development and can easily adapt the example shown below.

1. Create a codeunit. Set the property SingleInstance to Yes

Screenshot: Codeunit with SingleInstance property set to Yes

Figure 1 – Codeunit with SingleInstance property set to Yes

2. Add the Timer to C/AL Globals, and be sure to set the property WithEvents to Yes

Screenshot: 2.	Add the Timer to C/AL Globals, and be sure to set the property WithEvents to Yes

Figure 2 – Adding the Timer to C/AL Globals

Timer : DotNet "'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Timers.Timer" WITHEVENTS;

3. Add these additional C/AL Globals

InProcess : Boolean;

Started : Boolean;

4. Add the following code to the OnRun trigger

IF NOT Started THEN BEGIN

 Started := TRUE;

 CLEAR(Timer);

 Timer := Timer.Timer;

 Timer.Interval(5000); // fires every 5 seconds

 Timer.Start;

END;

5. A new trigger was added when the WithEvents property was set to Yes … it will look like this: EVENT Timer::Elapsed … to this trigger add the following code:

IF InProcess THEN

 EXIT; // in case the process is not yet done with the prior iteration

InProcess := TRUE;

COMMIT;

IF NOT CODEUNIT.RUN(CODEUNIT::YourProcessingCodeunitHere) THEN;

 // add a log entry somewhere

InProcess := FALSE;

6. Finally, I create a new, single-purpose servicetier using the following command and the following relevant parameters in the CustomSettings.config file

Command  sc create MicrosoftDynamicsNAVServer$Z binpath= "C:\Program Files\Microsoft Dynamics NAV \70\Service\Microsoft.Dynamics.Nav.Server.exe $Z"Parameters in CustomSettings.config<add key="ManagementServicesEnabled" value="false" /><add key="ClientServicesEnabled" value="false" /><add key="SOAPServicesEnabled" value="false" /><add key="ODataServicesEnabled" value="false" /><add key="NASServicesStartupCodeunit" value="ID of single instance codeunit" /><add key="NASServicesStartupMethod" value="" /><add key="NASServicesStartupArgument" value="" />

Word of caution: The process that is fired should not be a maintenance-intensive process or it will drag production performance to a crawl in some cases. Either the action performed should only happen once in a while even though the trigger is firing periodically (i.e., checking for an inbound receipt of data), or the action performed should be a very quick processing piece of code.

Be sure to document everything for posterity.

For more information on topics related to Microsoft Dynamics NAV development, read more on the ArcherPoint Developer Blog, written specifically for Dynamics NAV developers, or contact ArcherPoint.

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 23

$
0
0

ArcherPoint Microsoft Dynamics NAV Developer Digest – vol 23

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Question regarding XML conversion to 2013R2:

Question: I have a client that is using a version of the NAV base codeunit 6224 "XML DOM Management" to interact w/ some of their web services features. They are currently on 2009sp1 and want to upgrade to 2013R2. I recall that Automation Controls cannot work in 2013x versions and have to be reconfigured  to .Net interoperability instead.

Discussion: You can still use the XML DOM, but it must be changed to run client side and not on the service tier. That said usually the things for which the DOM was used can be converted to XMLports.

Alternatively, you can use one of the .NET libraries (XMLReader, XMLWriter, Link libraries) instead. This is probably more work, but it may be faster depending on the application. There are other options in the .NET world also if that is going to be explored. Probably need to review the usage and volume of the changes.

I'm thinking this code is used with regard to web services, so it will be used server side, so it must be converted to DotNet Interop.

Conclusion: Since the base codeunit 6224 still exists in newer versions of Nav2013x, it is still possible to use that for the process(es) that were using it for before. In the newer version of codeunit 6224 (same name), they just swapped out all references to Automation Controls w/ the newer DotNet type. Same functions, just now using DotNet.

Notes on bypassing the commit of Report Logging:

Interesting find on the Report Logger. We tested the Login and EndLogin triggers to see if rogue shutdowns would bypass the commit of the report logging data. The log is written to a temp table while the user is logged in. The temp table is necessary due to illegal transaction errors that can occur on the run report triggers during some transactions. So, we commit the log on the EndLogin trigger. What we found was that when logging out using the "x", or even Ctl-Alt-Delete, the trigger is executed properly. So, the only way a user can improperly log off, thus bypassing the commit, would be to unplug the computer, which apparently happens sometimes, especially in warehouse settings.

Question regarding exposing the To-Do table on Web Services:

Question: Is the To-Do table exposable on Web Services?

Answer: The To-Do page is accessible. It needs to be added in the web service setup. There also needs to be a web service running. I think it runs by default. Also, if it needs to be accessible outside your domain, that will take some extra security setup, so, a dev/tech resource would need to get involved.

Be sure to read more ArcherPoint developer blogs. If you have any further questions about customizing in NAV, please feel free to contact any of the NAV experts at ArcherPoint.

Using Custom NAV Permission Sets to Lock Down Special Activities

$
0
0

The Role Folk Blues: Using Custom Microsoft Dynamics NAV Permission Sets to Lock Down Special Activities

Sometimes, my phone rings, and one of my customers has a specific type of request. I’ve heard this request multiple times throughout my long and storied career of development, and I’ll share the solution with you, so you can do it, too.

The request goes like this: The customer needs to have certain activities restricted to certain people, but those activities don’t fit neatly into the standard Microsoft Dynamics NAV (Navision) paradigm of permission sets and the way that they lock down access to tables into just reading, writing, and deleting records. (And if you’re curious about where I come up with blog titles, the Permission Sets used to be called Roles, and I’m a big Cowboy Bebop fan, and the end theme for that show is called “The Real Folk Blues,” so there you go.)

You might have something like, “Only Alice the Sales Manager can delete an order over $20,000” or “Only Bob in customer service can enter a drop ship order.” A lot of developers will hear that request, and then run off to enter code in the OnDelete trigger or in the Drop Ship flag on a Sales Line that’s specifically looking for Alice or Bob’s username, and that works out pretty well—at least, until something happens. Alice goes on vacation, or Bob needs to stay home with his sick kids, and then no one can do that special thing that got locked down, but it needs to happen RIGHT NOW! And so then the poor developer has to rush a change into production that points at a backup user, and they might forget to remove the change when Alice comes back, and so on.

There’s a better answer, and it looks like this. Instead of hard-coding a username into your code, start by adding a new field to the appropriate setup table. For the examples above, you’d probably want Sales & Receivables Setup, but where it goes depends on the action and where it belongs in the organization. You’ll want to relate the new field to the Permission Set table, and call it something that makes sense, like “Large Order Deletion Permission Set” or “Drop Ship Order Entry Permission Set”. (For the first example, I’d also add a “Large Order Deletion Threshold” so that I didn’t have to hard-code the number 20000 into my code. The concept of a “large order” may go up as the company’s fortunes increase—or the company might need to expand to use the Japanese yen as an additional currency, and 20,000 yen is a considerably smaller sum than 20,000 dollars.)

Once you have your new field in place, add a function to a general-purpose codeunit that looks like this:

 

CheckPermissionSet(CheckUserID : Text;RoleID : Code[30];CheckForSuper : Boolean) : Boolean

IF RoleID = '' THEN BEGIN

 EXIT(TRUE);

END;

User.RESET;

User.SETRANGE("User Name",USERID);

IF NOT User.FINDFIRST THEN BEGIN

 EXIT(FALSE);

END;

AccessControl.RESET;

AccessControl.SETRANGE("User Security ID",User."User Security ID");

IF CheckForSuper THEN BEGIN

 AccessControl.SETFILTER("Role ID",'SUPER|%1',RoleID);

END ELSE BEGIN

 AccessControl.SETRANGE("Role ID",RoleID);

END;

AccessControl.SETFILTER("Company Name",'''''|' + COMPANYNAME);

IF AccessControl.FINDFIRST THEN BEGIN

 EXIT(TRUE);

END;

EXIT(FALSE);

 

There are two local variables in that function: AccessControl, which is a Record with a Subtype of Access Control; and User, which is a Record with a Subtype of User. Note that if you’re in a scenario where you have users from multiple domains, you’ll need to do some extra coding to handle them, since USERID doesn’t give you the domain name. That should be pretty unusual, though; I’ve been using some variation on this function for nearly 10 years, and I’ve only seen that once. The function should also return a Boolean value. I intentionally do not have it throwing up any error messages, because what happens to a user without the right permission is generally dependent on the context of the action—so you’ll need to handle that.

The filter on AccessControl for two empty quotes or COMPANYNAME lets you give the permission to a user in just one company, or across every company, just like other NAV permissions. I’ve also hard-coded the SUPER role into the search; you can add SUPER (DATA) if your users with that permission generally need access to these functions. (I suppose it is hard-coded, and generally hard-coding things is bad, but I figure that they’re probably not going to change the name of the SUPER role often enough to justify making that one dynamic. You can if you’re really adamantly against hard-coding, though.)

If you’re working with a version of NAV before 2013, you’ll have to made some adjustments to deal with the fact that the table names are a little different—the Access Control table was called Windows Access Control, for example, and there are some other adjustments you’ll have to make if you’re using database users instead of Windows authentication for your logins. Still, you should be able to make it work with just a little bit of tweaking.

Once you’ve put both the new setup table field and the new function to check for it into place, add some code in the appropriate trigger/codeunit/wherever to do whatever it is you need to do.

There are some out-of-the-box solutions for NAV that have some overlap with this, but they tend to be considerably more effort to implement (although they are generally more robust). For example, the document approval system has some stuff that goes beyond this, as does the Easy Security add-on.

Happy coding! Leave any weird stuff you find in the Comments section.

Be sure to read more ArcherPoint developer blogs. If you have any further questions about customizing in NAV, please feel free to contact any of the NAV experts at ArcherPoint.

Blog Tags:

ArcherPoint Microsoft Dynamics NAV Developer Digest - vol 24

$
0
0

ArcherPoint Microsoft Dynamics NAV Developer Digest – vol 24

The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.

 As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.

Question regarding NAV 2015’s integration with Microsoft Word and formatting outputs:

Question: With NAV 2015’s integration with Microsoft Word, will we now be able to do all "formats", such as checks and invoices, using Word as opposed to Visual Studio?

Answer: Invoices - absolutely! That's what NAV2015 is doing out of the box. Checks - probably not so much. The Word documents are not meant for "tricky" reports. It's also important to understand any code that is required as part of a report is still completed in the report object. Only the formatting/layout is completed in Word.

Question regarding the best way to perform a project implementation:

Question: I am on my first implementation project in quite some time. What do you do about databases and settings prior to go live?

I thought that having a Golden Settings database, and then a Test database that would be refreshed periodically from Golden during training and testing prior to going live was a good idea. Now I'm not so sure, as it turns out there are a lot of settings that only got done in Test.

Now I've been asked to somehow magically sync the two.

What have others done that worked well?

Answer: For the implementations I participated in, we made the adjustments in both test and the golden disk as we went along.

I use SQL scripts that move some key tables from test to prod or whatever "from" and "to" database you choose. This is especially important for tables that are not possible to do manually, i.e., personalizations. Permissions and Access Control are handy as well.

What has also worked well in other implementations was a code unit function that would delete all transaction history. This way, settings can be refined, master file records added, etc., and then a testing / training database can be easily generated. Obviously all settings are made in a Master Database.

An interesting article on diet and productivity:

Even the author points out that just about everyone knows what’s good and bad for them, but he makes a compelling case for realizing the impact diet has on our work performance.

What You Eat Affects Your Productivity

I would like to add to the author's observations:

Many years ago, I was introduced to a book by Barry Sears, PhD, Enter the Zone. It promotes a version of a low-carbohydrate diet, but based on insights of the biochemical interactions that occur when we eat what we do. One of the most insightful concepts from the book is that food is the most powerful drug you will take because of how it affects your body and that you will have to take it for the rest of your life. Another powerful insight is that you are never more than a meal away from getting back on track.

Like this article points out, Dr. Sears shows how eating smaller, frequent meals keeps the blood sugar at optimum levels for peak performance. He discusses how Olympic athletes have similar diets – for the same reasons: peak performance. Anyone who has wanted to doze off in the afternoon or lost focus writing software (or web content) can appreciate how alertness and creativity are essential for peak job performance.

As a developer and a creative person, I can feel the difference between the days when I follow a structured diet plan and a series of days when I “catch it on run”.

Viewing all 372 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>