Uploader Submission Callback

The Osmos Uploader provides a Callback to the host page when the Osmos Uploader window closes. The callback is made to the function mapped to the completionHandler key. This key is optional. If a handler function is assigned, it will provide:

  1. originalFileUrl: URL of original uploaded file. The file will be available at this for the data retention duration configured on your Osmos account, after which the URL will return 404. In order to to avoid name collisions, the filename will be appended with GUID values.

  2. reachedTransformStep: Boolean indicating if the user successfully reached the transformation step

  3. successfullySubmittedData: Boolean if the user successfully submitted data and completed the upload experience

  4. numRecordsSubmitted: Number of records submitted

  5. skippedRowNumbers: Array of row numbers that were skipped, starting at data row number 0, and not including the header row in the count.

  6. jobId: The UUID which corresponds to this specific Osmos Uploader run.

The Callback is triggered by one of two ways:

1. When the user selects the submit button

2. When the user closers the modal (Callback will be triggered with zero rows submitted)

For more information on Optional configuration features like completionHandler, see Optional Settings.

Here’s an example of a code snippet for a completionHandler callback

Osmos.configure({
  userID: window.curUserID,
  completionHandler: async (params)=> {
    console.log(params)
  },
  schema: {
    fields: [
      {
        name: 'field1',
        displayName: 'Field 1'
      },
      ...
    ],
  },
  ...
}

interface CompletionHandlerArgs {
  originalFileUrl: string,
  reachedTransformStep: boolean,
  successfullySubmittedData: boolean,
  numRecordsSubmitted: number,
  skippedRowNumbers: Array,
  jobId: string
}

Last updated