Friday, February 17, 2017

How to skip unlicensed objects when exporting as text in NAV

calculation-1889005_1920

One of the tools I often use to review the objects or for debugging is Prism (https://www.stati-cal.com/). It is a great productivity tool for NAV Developers and Architects which helps quickly and effortlessly to get an overview of C/AL code, modules and dependencies. There are a couple of options in the tool to import the objects, one of the option is to have the objects in a .txt format which I normally use.  One issue I often encounter when I export all the objects in .txt format is, our license does not have permission to export all the objects into text format this is because of some restrictions placed by the vendors on their add-on objects.

In this blog, I will discuss different ways to export the objects into text format and by skipping the objects which the license does not have permission.

Option 1:

Use Powershell command Export-NAVApplicationObject with an ExportTxtSkipUnlicensed option. My colleague William Warnke explained this cmdlet and other in his blog. Please read it.

The CmdLet uses the license is which is uploaded into the database, but if you change the license temporarily with change function it will not work, so the license should be uploaded to use this option.

Option 2:

Use the Edit –> Toggle Mark function on all the objects and then unmark the objects which you don’t have permission, but for this you need to know which objects you don’t have permission to export; otherwise you have to try to export all the objects and when you get an error for an object exclude that object in the next iteration and repeat this process, this is very time consuming and not efficient.

I think this is the only option for the older databases before NAV 2009.

Option 3:

This option works only for newer versions 2009 and above. Select all the objects and use the Lock Function to Lock all the objects, it will lock only those objects which you have permission to export into text format. Once you lock the objects filter the objects which are locked and export them into .txt.

(Thanks again to William Warnke for the tip)

Do you have any other tips or suggestions? Please let me know in the comments below.








Share:

4 comments:

David Bouillot said...

I knew the first two options but the third is a nice trick... Thank you for sharing

Cu Huy said...

I too use Prism extensively for managing objects but didn't know about the trick in option 3. Can't wait to try it out. Thanks for sharing.

Suresh Kulla said...

Glad to share.

Christian Clausen said...

The finsql.exe command-line tool has an undocumented parameter to skip unlicensed objects while exporting to txt: ExportTxtSkipUnlicensed=1. The parameter works from NAV 2015 upwards. I guess Microsoft introduced this to support the same PowerShell feature.

We use the parameter in Prism's mirror functionality, which allows you to connect directly to a database, so you don't have to export txt files manually, but always have a mirror available: https://stati-cal.com/learn.html#exportcumb