Reference manual

Mirrors

A mirror is a local copy of the objects of a Dynamics NAV database, kept up to date in the background. Prism for C/AL exports the objects as text through the C/SIDE development environment, finsql.exe, and you open the mirror as an object store without exporting anything yourself. You define and manage mirrors on the Mirrors page of the Control Panel.

Save, then sync Every 15 minutes SYNCHRONIZATION INTERVAL Re-initialize Create the mirrorServer, database, finsql.exeand service tier First synchronizationfinsql.exe exports all objectsto the mirror folder Sync UpdateExports new andchanged objects Sync CommitWrites them, removesdeleted objects Post-update hookOptional; runs whenobject files changed Open mirrorOpens it as an object store,once it has synchronized Save, then sync EVERY 15 MINUTES Once synchronized RE-INITIALIZE Create the mirrorServer, database, finsql.exeand service tier First synchronizationfinsql.exe exports all objectsto the mirror folder Sync UpdateExports new and changed objects Sync CommitWrites them, removes deleted objects Post-update hookOptional; runs when object files changed Open mirrorOpens it as an object store
A mirror's life: one full export, then a synchronization on every interval until you re-initialize it.

Opening it

  • Select Mirrors in the rail of the main window.
  • Select File › Mirrors… in the main window, or press Ctrl+M.
  • Select Open mirror… on the Home page while no mirror is defined.
Prism for C/AL Mirrors page with a synchronized mirror selected
1 2 3 4
The Mirrors page with a mirror selected.
#NameDescription
1Mirror listYour mirrors, and the commands for all of them. See Mirror list.
2Mirror commandsTest, open, re-initialize or delete the selected mirror. See Mirror settings.
3StatusThe state of the mirror's last synchronization. See Mirror status.
4Mirror settingsThe selected mirror's settings, in groups. See Mirror settings.

Mirror list

The left side of the page lists your mirrors. The commands above the list act on all mirrors.

The mirror list on the Mirrors page, with one mirror synchronizing and the unsaved changes banner showing
1 2 3 4 5
The mirror list while a mirror synchronizes, with unsaved changes.
#NameDescription
1 New mirror Adds a mirror. See Create a mirror.
2 Synchronize Synchronizes all mirrors that have automatic synchronization on, now. See Synchronize mirrors.
3 More actions Import… and Export…. See Export and import mirrors.
4 Unsaved changes Save saves all mirrors; Discard drops every unsaved change.
5 Mirror The mirror name, its server and database, and Sync on or Sync off. A bar under the row runs while that mirror synchronizes.

Changes to mirrors are not saved until you select Save in the banner that reads You have unsaved changes. Save saves all mirrors at once; Discard drops every unsaved change.

When you open a mirror from the page, select Synchronize or Export…, or restart Prism to apply a theme change while there are unsaved changes, Prism asks Save your changes?: "There are unsaved changes to one or more mirrors."

ButtonEffect
SaveSaves all mirrors, then carries on.
Don't saveCarries on without saving. Your changes stay on the page, unsaved.
CancelStops, and leaves your changes unsaved on the page.

Mirror settings

The right side of the page shows the selected mirror: its commands, its status and its settings.

The details of a selected mirror: the command bar, the Status card and the Identity and Development environment groups
1 2 3 4 5 6
The details of the selected mirror.
#NameDescription
1 Test connection Tests that Prism can reach the database and the service tier. Prism says Mirror is OK! or lists the problems. Enabled once the NAV adapter, server, database name and finsql.exe path are filled in, and a user name when you give a password.
2 Open mirror Opens the mirror as an object store. Enabled once the mirror has synchronized at least once.
3 Re-initialize Exports all objects again. See Re-initialize a mirror.
4 Delete Marks the mirror for deletion. It is deleted when you select Save; Discard keeps it.
5 Status The state of the mirror's last synchronization. See Mirror status.
6 Setting groups Identity, Development environment, Database, Service tier, Filters and Synchronization. They start expanded; the settings are listed below.

Each mirror has these settings, in the groups the page shows. They apply from the mirror's next synchronization.

SettingOptionsDefaultEffect
Identity
Mirror name Any text Empty; the list then shows Server.Database The name shown in lists and menus.
Mirror Id Read-only Set when you first save the mirror The mirror's unique identifier, with a button that copies it. Use it in a post-update hook to act on one mirror only.
Development environment
finsql.exe A full path; … opens Select finsql.exe Empty The C/SIDE development environment that exports the objects. Use the one that belongs to the database. A version no adapter supports shows This version of NAV (…) is not supported by any NAV adapters. A file that does not exist shows The file does not exist.
Database
Server A SQL Server name Empty The SQL Server that hosts the NAV database.
Database name A database name Empty The NAV database on the server.
User name A SQL Server login Empty: Windows authentication The login Prism and the development environment connect with.
Password The login's password Empty: Windows authentication The field shows the password as plain text. Prism stores it encrypted and never exports it.
Trust server certificate On, Off Off Skips validation of the SQL Server certificate chain. Turn it on when the server uses a self-signed certificate.
Service tier (shown when the NAV adapter supports service tiers)
Server name A host name; … looks it up Empty The host of the NAV service tier. See Choose a service tier.
Instance name A service instance name Empty The service tier instance.
Management port A port number 7045 The service tier's management port.
Filters
Object ID include filter ID ranges separated by |, such as ..41999999|43000000..43999999|45000000.. Empty: every object Mirrors only the objects whose IDs match. Use it to keep to the objects your NAV license lets you export as text.
Version list exclude filter Values with * wildcards, separated by |, such as *SOMEADDON*|RESERVED Empty: no object is left out Leaves out the objects whose version list matches.
Synchronization
Object encoding A blank entry, or a code page from the list Blank: the Default object encoding setting The text encoding of the mirrored object files.
Automatic synchronization On, Off On When on, Prism synchronizes the mirror on the Synchronization interval and when you select Synchronize.

Prism-wide mirror settings, such as the interval and the connection timeout, are in the Mirrors settings.

Mirror status

The Status card of a mirror whose last synchronization failed, with the links View details, Copy to clipboard and Troubleshoot
1 2 3 4
The status of a mirror whose last synchronization failed.
#NameDescription
1StatusSays when the synchronization failed, and why.
2View detailsShows the error message, its details and the stack trace.
3Copy to clipboardCopies the same text.
4TroubleshootOpens Troubleshooting in your browser, at A mirror cannot contact a service tier.
StatusMeaning
Synchronization in progressPrism is synchronizing the mirror now.
Not synchronized, yet. Press 'sync now' button, or wait until next scheduled synchronizationThe mirror has never synchronized, so it cannot be opened yet.
Ok — last synchronized …The last synchronization succeeded, at the date and time shown.
Error when last synchronized (…)The last synchronization failed. The mirror keeps the objects of its last successful synchronization.

After an error, three links help you find the cause:

  • View details shows the error message, its details and the stack trace.
  • Copy to clipboard copies the same text, for instance to send to us.
  • Troubleshoot opens Troubleshooting in your browser.

Create a mirror

Create a mirror to browse the objects of a NAV database. You need the C/SIDE development environment that belongs to the database, and NAV 2013 or later.

  1. Select New mirror. A row named <New Mirror> is added and selected.
  2. Type a Mirror name.
  3. Select … next to finsql.exe and pick the development environment. Prism sets the NAV adapter from the file's version.
  4. Type the Server and Database name. Leave User name and Password empty to use Windows authentication.
  5. If the development environment needs a particular service tier, choose a service tier.
  6. Select Test connection. Prism says Mirror is OK! when it can reach the database and the service tier.
  7. Select Save in the banner.
A new mirror filled in on the Mirrors page, with the unsaved changes banner showing
1 2 3 4 5
A new mirror, tested and ready to save.
#NameDescription
1SaveSaves the new mirror (step 7).
2Test connectionChecks the database and service tier (step 6).
3Mirror nameThe name you typed (step 2).
4finsql.exeThe development environment, with … to pick it (step 3).
5Server and Database nameThe database to mirror (step 4).

The mirror synchronizes at the next scheduled synchronization, or when you select Synchronize. The first synchronization exports every object, which takes a few minutes. Later synchronizations export only new and changed objects and remove deleted ones.

Open a mirror

Open a mirror to browse its objects in a Workspace window. The mirror must have synchronized at least once.

  1. Select Open mirror… on the Home page. The Open Database Mirror dialog opens.
  2. Select the mirror, then select OK, or double-click the mirror.
Prism for C/AL Open Database Mirror dialog with a mirror selected
1 2 3 4
The Open Database Mirror dialog.
#NameDescription
1 Status Green when the last synchronization succeeded, red when it failed, grey when the mirror has not synchronized yet. Hover it for the reason.
2 Mirror list Your mirrors, with the columns Mirror Name, Server Name, Database Name, NAV Adapter and Sync.
3 OK Opens the selected mirror.
4 Cancel Closes the dialog.

The mirror then opens as described in Opening an object store.

You can also select a mirror under File › Open › Mirror in the main window, select Open mirror on the Mirrors page, or reopen it from the recent list on the Home page. A mirror that has not synchronized yet does not open; Prism says Mirror has not been synchronized, yet.

While a synchronization commits its changes, the mirror does not open: Prism says The mirror is committing changes; please try again in a few secs. or Sorry, the mirror just started committing changes; please try again in a few secs. Wait a few seconds and open it again. See A mirror does not open while it commits changes.

Synchronize mirrors

Prism synchronizes every mirror that has Automatic synchronization on: first two minutes after it starts, then on the Synchronization interval, 15 minutes by default. To synchronize now:

  1. Select Synchronize on the Mirrors page. If you have unsaved changes, Prism asks you to save them first.
  2. Wait while the Synchronizing chip shows beside the page title. The Home page shows the progress too.

Synchronize is unavailable while a synchronization runs. When a synchronization fails, the mirror's status says why.

Re-initialize a mirror

Re-initialize a mirror when fields have been renamed in NAV or many objects have changed, or to start a failing mirror over. The mirror must be saved and have synchronized once.

  1. Select the mirror on the Mirrors page.
  2. Select Re-initialize. Prism asks Re-initialize mirror?
  3. Select Yes. Prism drops the mirror's copy of the objects. The next synchronization exports them all again; select Synchronize to start it now.

The full export takes a few minutes, and you cannot open the mirror until it has finished.

Choose a service tier

Choose a service tier when the development environment must reach a particular NAV service tier to export objects. Service tier selection needs NAV 2013 R2 CU10 or later, and the mirror's finsql.exe, Server and Database name filled in.

  1. Select … next to Server name in the Service tier group. The Select Service Tier window lists the service tiers registered in the mirror's database.
  2. Select a service tier. The columns are Server Name, Service Instance, Management Port, Last Active and Status.
  3. Select OK, or double-click the row. Prism fills in Server name, Instance name and Management port.
  4. Select Save in the banner.
The Select Service Tier window.
#NameDescription
1Service tiersThe service tiers registered in the mirror's database (step 2).
2OKFills in the mirror's service tier settings (step 3).
3CancelCloses the window and changes nothing.

If Prism cannot read the list from the database, it says Error fetching service tier information from database. You can also type the three values yourself. Selecting OK with no row selected says No service tier selected. Please select service tier or press Cancel.

Export and import mirrors

Export your mirror definitions to share them with a colleague or move them to another computer.

To export:

  1. Select More actions › Export…. If you have unsaved changes, Prism asks you to save them first.
  2. Choose a file name. Prism saves every mirror to a .mirrors file, without passwords.

To import:

  1. Select More actions › Import… and choose a .mirrors file. The Import database mirrors window lists the mirrors in the file, with the counts Candidates and Will import.
  2. Check each mirror's NAV adapter and change it if needed. A mirror that already exists shows the reason in the Conflict column and is not imported.
  3. Select Import (N). The mirrors are added to the list.
  4. Type the passwords of mirrors that use SQL Server authentication, then select Save in the banner.
The Import database mirrors window.
#NameDescription
1Candidates and Will importHow many mirrors the file holds, and how many will be imported.
2MirrorsThe mirrors in the file, with Mirror name, Server and Database.
3NAV adapterThe adapter the mirror will use; change it if needed (step 2).
4ConflictWhy a mirror cannot be imported, such as a mirror that already exists.
5Import (N)Adds the mirrors to the list (step 3).
6CancelCloses the window and imports nothing.

Run a script after an update

Run a script of yours each time a mirror update writes object files, for instance to copy them to a version control folder or an AI workspace. One script serves all mirrors.

  1. Select Copy sample script in Settings › Mirrors › Post-update hook, paste it into a .ps1 file and adapt it.
  2. Select Browse... next to Post-update hook and pick the script.
  3. In Input, choose what the script receives on standard input.
The Post-update hook setting on the Settings page, with a script path, the Input choice and Copy sample script
1 2 3 4
The post-update hook in the Mirrors settings.
#NameDescription
1Post-update hookThe path of your script (step 2).
2Browse...Picks the script.
3InputWhat the script receives on standard input (step 3).
4Copy sample scriptCopies a sample script to adapt (step 1).

Prism runs the script after a synchronization, or the opening of a mirror, that added, changed or deleted object files. To act on one mirror only, compare PRISM_MIRROR_GUID with its Mirror Id. Clear the path to stop running the script.

ScriptRuns under
.ps1PowerShell 7 if it is installed, otherwise Windows PowerShell 5.1
.bat, .cmdcmd
.shsh

The script receives these environment variables:

VariableValue
PRISM_MIRROR_DIRThe mirror's root folder.
PRISM_MIRROR_OBJECTS_DIRThe folder that holds the .txt object files.
PRISM_MIRROR_NAMEThe mirror name.
PRISM_MIRROR_GUIDThe Mirror Id.
PRISM_MIRROR_DB_SERVERThe database server.
PRISM_MIRROR_DB_NAMEThe database name.
PRISM_UPDATE_KINDFull or Incremental.
PRISM_ADDED_COUNTThe number of object files added; on a full update, every object.
PRISM_CHANGED_COUNTThe number of object files changed.
PRISM_DELETED_COUNTThe number of object files deleted.

The Input setting chooses what Prism writes to the script's standard input:

InputStandard input
NoneNothing; the script uses the environment variables only.
PlainTextThe update kind on the first line, then one line per file, prefixed + for added, ~ for changed and - for deleted.
JsonOne JSON object with the time, the mirror's name, Mirror Id, folder, server and database, the update kind, and the lists of added, changed and deleted files.

Prism stops a script that is still running after 30 seconds. A script that exits with a code other than 0, or that times out, is recorded in the log; Prism shows no message.