×
Menu
Index

3.3.14.3. M-FILES - Link Scanned Documents to an Existing M-FILES Object

 
Sometimes you want ChronoScan to link the scanned documents/metadata with a specific M-FILES object. This article shows the basics steps to do this:
 
Initial sample structure:
 
SAMPLE FOLDER class will hold a set of SAMPLE DOC objects:
 
 
SAMPLE DOCS is a subtype of SAMPLE FOLDER:
 
 
Sample data:
 
 

Method 1: Send the ID of the Parent Object Using Command Line Switches.

 
Start ChronoScan adding a custom command line switch to it:
 
ex: chronoscan.exe -myMfilesParentID:"17"
 
On ChronoScan's form editor, create a new Field called ParentID and add to the OnValidation script the following lines:
 
If UserField_ParentID.value = "" Then
    UserField_ParentID.value = ChronoApp.cmdline_GetValue("myMfilesParentID")
End If
 
Now all scanned documents on this session will be linked to object ID 17.
 
On the export configuration set the correct Owner to the exported documents:
 
 
 

Method 2: Allows Users to Find Parent Documents on a ChronoScan Field Using the Client API

 
With this sample script we will allow to select the parent folder directly selecting the owner on the ChronoScan form:
 
 
Edit the OnEnterEdit script of your ParentID field:
 
Vault = "Your vault name here"
ObjectId = 161 ' Your object Id here
 
Set oMFAPIApp = CreateObject("MFilesAPI.MFilesClientApplication")
 
Set g_oVault = oMFAPIApp.BindToVault("Your vault name here", 0, True, True)
 
Set oItems = g_oVault.ValueListItemOperations.GetValueListItems(ObjectId, True, 0)
 
Call UserField_ParentID.HelpList_Clear()
 
For Each Item In oItems
    Call UserField_ParentID.HelpList_AddValueDescription(Item.Name, Item.ID)
Next
 
Call UserField_ParentID.HelpList_Populate()
 
On your export configuration ensure to set the parent Id as the sysval_list_desc_ParentID (or your field name)