ArcherPoint Dynamics NAV Developer Digest - vol 49

ArcherPoint Dynamics NAV Developer Digest - vol 49

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.

William Warnke on tools to import and export text objects in NAV:

I’ve brought this up to a couple people already in the context of extracting text objects from older pre-2013 NAV Clients to use in source/merge tool/prism. I’ve used the second project myself to make an object extractor and I abandoned that once they introduced the external exportobject/importobject finsql.exe commands. Although a command line option for older clients would be nice…. 🙂

Dynamics NAV and the ROT table

Edgerunner – C/Side Integration Utilities

Question on creating a list page:

I have created a list page that is used for a lookup by a client. If they have a value already in the field and they select the lookup button they want the list to default to the item in the field. Normally this would be easy, but they want it to show non-blocked items in one instance and show all items in another instance. I tried the SetcurrentKey and then filter, but I am not getting the results I need. It does not show the full list when it goes to the current Field value.


Kyle Hardin:

You might be able to make this work as long as the Validation has already happened – otherwise, that field isn’t actually in the record yet. You won’t be able to do this with the default lookup logic (usually set on the table itself with a LookupPage property) so you’ll have to write some code, but if you set the context correctly on your lookup before you do a runmodal with lookupmode = true, it should work.

Here are some examples:

LookupDimValue.SETFILTER(Code, DefaultDim.”Allowed Value Filter”);
LookupDimValue.SETRANGE(“Dimension Code”, Rec.”Dimension Code”);
VALIDATE(“Dimension Value Code”, LookupDimValue.Code);

The above runs the page set in the LookupPage property set for the table LookupDimValue.
Alternatively, you can also declare a variable of type Page and do something like

LookupDimValue.SETFILTER(Code, DefaultDim.”Allowed Value Filter”);
LookupDimValue.SETRANGE(“Dimension Code”, Rec.”Dimension Code”);

Follow up on killing idle sessions in Dynamics NAV 2009 R2 (see Dev Digest #47):

Jon Long: Be aware that deleting a session from the session table does not actually kill the session. However, it does free up a seat. So, this is an unintended “feature”, a hack actually, that we can use, but probably shouldn’t build it into a production db for client use. I use it if all seats are taken, and I need to log in and do something.

To actually “kill” a session, effectively kicking a user off, in addition to deleting the session record, you also need to call this in code:


Kyle Hardin: NAV 2009R2 actually kills the SQL session, too, if you delete the NAV session. The feature than Jon mentioned didn’t start until 2013. That having been said, the SQL Agent suggestion that Kollette mentioned will work regardless the version of NAV since you are killing it from the back end. NAV 2013R2 and 2015, you have an idle timeout setting on the NST.

Question regarding importing records into NAV via SSIS:

We have a client that is importing records into a NAV table via SQL Server Integration Services (SSIS). They have a NAS that subsequently wakes up and reads any new records in this NAV table and it processes them accordingly. However, for some reason, the NAS does not “see” any new records in this table when it wakes up (I believe the interval is every one minute). They have a Boolean field that their NAS filters on (something like RECORD.SETRANGE(Processed,FALSE);) to pull new records. Only when they cycle the NAS does it see any new records in this table. They are running NAV 2013 R2. My first thought was that they aren’t formatting some fields correctly because it’s getting populated outside of NAV, but that wouldn’t explain why it works after they bounce the NAS service. They would prefer not to use the NAS to import into this. Does anyone have any thoughts on this?

Kyle Hardin:

This sounds like a caching problem with the NAS, meaning new records show up in the SQL table, but the NAS has a cached version and doesn’t know that new records showed up.

A couple of things to try. First, make sure that whatever your NAS is calling (report, codeunit, whatever) does a COMMIT as it exits cleanly. And second, at the beginning of your code, try a SELECTLATESTVERSION which forces it to skip the cache and fetch fresh data directly from the SQL server.

Check out this article:

NAV 2013 Job Queue doesn’t see existing records

Reply: Kyle, you’re the man! This worked!

Trending Posts

Stay Informed

Choose Your Preferences
First Name
Last Name
Subscription Options
Your Privacy is Guaranteed