HowTo: Transform Metadata Using Script Mapping

Follow

While a direct one-to-one metadata mapping suffices in most cases, it can be useful to perform various transformations on the metadata as part of the migration.

To this end, Proventeq Migration Accelerator offers a comprehensive and powerful scripting environment that allows you to define any metadata mapping through fully-fledged PowerShell and Python scripts.

A common use case for metadata transformation might be the mapping of a Document ‘Name’ field that has a greater string capacity in the source system than in the target. A mapping could be used to truncate the source value if it exceeds the bounds of the target field. This use case is illustrated in figure 15.

FIGURE_15_-_POWERSHELL_METADATA_MAPPING.png

Script Mappings are ideal for individual usual cases whereas Function Mappings are preferable for more generic operations that can be used across multiple metadata mappings (i.e. string concatenation, date formatting). In both cases, the scripts can be provided direct access to the active item’s variables, where they can be read and modified with ease.

Using Script Mapping

  1. Click on the “Settings” button in the “Migration Tasks” pane at the bottom of the Proventeq Migration Accelerator Home screen for the selected Migration Task.

    MIGRATION_TASK_PANE.png

  2. Select the “Content Type Mapping Settings” tab in the “Migration Task Settings” window, if it is not already open.

  3. Click on the “Settings” button of the desired Content Type mapping in the “Mappings” pane.

    ADD_A_NEW_SOURSE_CLASSIFICATION.png

  4. Click on the “Settings” button from the “Content Type Mapping Settings” window as shown in the figure below.

    CONTENT_TYPE_MAPPING_SETTING.png

  5. Select “Script” in the “Mapping Type” drop-down menu of the “Metadata Mapping” window as shown below:

    Metadat_Mapping.png

  6. For the Script Language select ‘PowerShell’.

  7. Enter a descriptive name such as Get-Name in the Script Name

  8. Replace the text in the script body area with the following script definition:

    
    $mimetypeLength= $migrationitem.SI.mimetype.length
    $maxLimit = 100 - $mimetypeLength
    $finalStr = $OriginalFileName
    if ($OriginalFileName.Length -gt $maxLimit )
    {
        $dummyString = $ OriginalFileName.Substring(0,$maxLimit)
        $finalStr = $dummyString.Substring(
    
            0,$dummyString.LastIndexOf(' ')
        )
    
        $finalStr = $finalStr + $migrationitem.SI.mimetype 
    }
    
    else
    
    {
        $finalStr = $finalStr + $migrationitem.SI.mimetype 
    }
    
    return  $finalStr
    


  9. If required, select any additional variables from the “Select variable” drop-down menu, e.g. OriginalFileName.

  10. Click on the “Save” button to save the mapping.

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments