×
Menu
Index

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.
 
If you plan to have more than 5000 documents in your library, please read the guideline How to fix error "The number of items in this list exceeds the list view threshold" too. There are some built-in limits on SharePoint that complicate the setup after the 5000 documents threshold is reached.
 

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:
 
 
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

 
Open the PURCHINV_BUS_DOCS library setup. For the synchronization to work you need to fill in Import Config. Package Code and optionally Init Record Template Code fields:
 
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.
 
Create a new Configuration template as follows, and fill its code into Init Record Template Code field in the Library setup:
 

Testing the synchronization

 
Now Release the list setup and test the synchronization:
 
 
Now, go to the PURCHINV_BUS_DOCS library setup and select Synch. Differences on SP:
 
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:
 
 

Troubleshooting