Skip to content

Attachments Transfer

Stevan Freeborn edited this page Mar 25, 2023 · 4 revisions

This command is intended to help Onspring customers transfer attachments from one or more attachment/image fields from one or more records in a source app to another target app. The source and target app can be in the same instance or they can be in different instances.

General Usage

When running this command you will need to provide it with a Settings File in .json format, a Source API Key, and a Target API Key to inform the app where the attachments should be transferred from and where the attachments should be transferred to.

These pieces of information need to be provided as command-line arguments.

onspringcli.exe attachments transfer -s settings.json -sk 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000 -tk 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000

Settings File

The settings file should contain the following key-value pairs. See example here

  • Source App Id
    • This is the id of the app where your attachments are located.
  • Target App Id
    • This is the id of the app where you want to transfer your attachments.
  • Source Match Field Id
    • This is the id of the field in your source app that you want to use to identify which record in your target you want to move attachments to for a given source record.
    • This field should be a number, date/time, text, auto-number, or formula field with a non-list output type.
  • Target Match Field Id
    • This is the id of the field in your target app that will hold the matching value to the source record which will identify a given target record as the record to move a soure records attachments to.
    • This field should be a number, date/time, text, auto-number, or formula field with a non-list output type.
  • Attachment Field Mappings
    • This is a dictionary of field pairings that identifies attachments in what source field should be moved to what target field for a given record.
  • Process Flag Field Id
    • This is the id of the field in your source app that will be used to identify which records in the source app should be processed by the tool.
    • This should be a single select list field.
  • Process Flag Value
    • This is the value of the flag field that you want to use to identify which records in the source app should be processed by the tool.
    • This value can be the list value itself or it's corresponding GUID id which can be obtained by exporting the Fields & Objects report for the source app or using the Onspring API.
  • Processed Flag Value
    • This is the value of the flag field that you want to use to identify which records in the source app have been processed by the tool.
    • The tool will also update the flag field with this value once a source record has been processed to indicate as much.
    • This value can be the list value itself or it's corresponding GUID id which can be optained by exporting the Fields & Objects report for the source app or using the Onspring API.

Notes:

  • Api Keys can be obtained as outlined in this repository's README.md API Key section.
  • App Ids can be obtained...
    • by using the Onspring API's /Apps endpoint
    • by looking at the url of the app in your browser. i.e. https://instance.onspring.com/Admin/App/134
  • Field Ids can be obtained...

Options

The tool currently has a number of options that can be passed as command line arguments to alter the behavior of the tool. These are detailed below and can also be viewed by passing the --help option to the tool.

  • Target Api Key: --target-api-key or -tk
    • Allows you to specify the api key that will be used to transfer attachments to the target instance.
    • Example usage: onspringcli.exe attachments transfer -tk 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000
  • Settings File: --settings-file or -s
    • Allows you to specify a path to a .json file which contains the necessary settings the command needs to run as outlined in the General Usage section.
    • Example usage: onspringcli.exe attachments transfer -s settings.json
  • Records Filter: --record-filter or -rf
    • Allows you to specify a comma-separated list of record ids whose attachments should be transferred.
    • Example usage: onspringcli.exe attachments transfer -rf 1,2,3
  • Report Filter: --report-filter or -rpf
    • Allows you to specify the id of a report whose records attachments should be transferred.
    • Example usage: onspringcli.exe attachments transfer -rpf 1

Notes:

  • The records filter and report filter are additive to one another.
  • These are in addition to the Global Options detailed in this repository's README.md.
Clone this wiki locally