How to synchronize new documents from SharePoint
In this example, you will use NavSherpa to synchronize new files, that users manually uploaded to SharePoint, into NavSherpa Smart Tree. This tutorial uses PURCHINV_BUS_DOCS library from demo RapidStart package (/sites/your_demo_site/purchase/BusinessDocs on SharePoint), but similar steps will work with any Library setup.
Preparations on SharePoint
For a successful document synchronization, you need to provide NavSherpa with primary key values to attach the document to the right record in NAV. In case of Purchase Header table the primary key fields are the following:
-
Document Type – You will set this key in a
Configuration template on NAV side.
-
No. – User should provide the invoice number in a metadata field on SharePoint, and this field should be included in the Library setup.
In case of PURCHINV_BUS_DOCS library you are already exporting No. field into PurchaseInvoice column on SharePoint.
You can either let the user fill this value manually as a required field, or you can use a Document Set feature called Shared Columns. With this function user just needs to place the file in a proper folder and SharePoint will automatically fill in the required metadata:
Open the BusinessDocs library on SharePoint and go to Library Settings:
Go to Content Types settings and select Document Set content type:
Now select Document Set settings:
In the Shared Columns section select at least the primary key column (PurchaseInvoice in your case) as a shared column. And, if you don’t have the PurchaseContract content type in the list of allowed content types, add it, too:
Optional, but recommended step is to make PurchaseContract content type as a Default Content Type. You can do this in the library settings with function Change new button order and default content type:
Now, when user uploads a new document into SharePoint Library with Upload → Files button or drag-and-drop, it will be automatically added with this default Content Type – and it will get the value of PurchaseInvoice column from the parent document set.
You can either manually prepare document set folders for users to upload new files – or in this case, you can just upload one file to the Business Documents library of the purchase invoice from NavSherpa Smart Tree, and NavSherpa will create the document set for you.
Set up the synchronization in NAV/BC
Library setup
The
Import Config. Package Code field sets a
RapidStart Configuration Package that defines, which tables can NavSherpa synchronize back into NAV (and in case of SharePoint Lists which fields, too). You can use our demo
NAVSHERPA_IMPORT package and add your tables into it:
Please ensure, that you have your table in the RapidStart package (table 38 Purchase Header in this case).
In case of Purchase Header table you need to set up the default value of the Document Type field too. Remember, NavSherpa will get the No. of the invoice from SharePoint, but the Document Type is set in NAV.
-
The configuration template must have the same
Table ID like the Library setup.
-
You can set up all default values in the
Lines area. In this example, you are automatically setting the
Document Type field to
Invoice.
Testing the synchronization
Now Release the list setup and test the synchronization:
-
Upload a new file into the document set folder in the
BusinessDocs library on SharePoint.
-
Assure, that the record has filled in
PurchaseInvoice column with a valid purchase invoice number from NAV.
If the synchronization went well, you will see the file in your selected invoices’ Smart Tree:
Run the synchronization automatically
To start the automatic synchronization, go back to
PURCHINV_BUS_DOCS library setup and set the field
Synchronization Method to
Automatic. After the Library setup release, NavSherpa will start the automatic synchronization with Job queue or service tier job:
Please, note the following fields: Last Check Date and Last SharePoint Sync. Date:
-
Last Check Date shows, when NavSherpa last checked for new documents on SharePoint.
-
Last SharePoint Sync. Date is the time, when NavSherpa synchronized a new file from SharePoint for the last time. When checking for new documents, this date and time is used as a timestamp, and NavSherpa gets just the document that were changed after.
Troubleshooting