LogoLogo
Back to OsmosDeveloper DocsOsmos BlogWhat's New
  • Welcome to Osmos
  • 👋Getting Started with Osmos
    • Terminology
  • 🎉What's New
  • 🧩Osmos API Reference
  • ⌨️Osmos Chat
  • 👩‍💻Developer Docs
    • Manage API Keys
    • Embedding an Osmos Uploader
    • Embedding Uploader Jobs Table
    • Turning on Advanced Mode Uploader
    • Customizing Uploader Styling
    • Passing Parameterized Fields
    • Configuring Uploader's "Recall" functionality
    • Optional Uploader Settings
    • Uploader Submission Callback
    • Configuring AutoClean for your Uploader
    • Uploader Client-Side Validation
      • Data Validators
      • Checking for Duplicate values in a field
      • Creating Dropdown-Controlled Fields
      • Dynamic Dropdown Options
      • Dropdown Interaction with Validation Functions
    • Validation and Transformation Webhooks
      • OpenAPI Validation Webhook Testing
    • Parser Webhook for file based connectors
  • 🔠Datasets
    • Osmos Datasets
      • Uploading Data to your Table
      • Creating Primary and Foreign keys
      • Osmos Dataset Destination Connector
      • Osmos Dataset Source Connector
      • Dataset Edits
    • Datasets Query Builder
      • Query Builder Metadata
    • Performing Look Ups
      • Performing Joins
        • Types of Joins
  • ⏏️Uploader
    • Creating an Osmos Uploader
      • Testing your Osmos Uploader
    • Uploader Validation Summary
    • Advanced Mode
      • Overview
      • Process
    • Standard Mode
      • Overview
      • AutoClean
      • Process
    • AI AutoMapping
    • Uploaders Page
    • Uploader Details Page
  • 🔀Pipelines
    • Step 1. Select the Source
    • Step 2. Select a Destination
    • Step 3. Map & Transform Data
    • Step 4. Schedule the Pipeline
    • Step 5. Review & Confirm
    • Pipelines Page
    • Pipeline Details Page
  • ⏩Data Transformations
    • AutoMap
    • Column Mapping & Data Cleanup Panel
    • QuickFixes
    • AI Value Mapping
    • AI AutoClean
    • Lookups
      • Performing Lookups
    • SmartFill
    • Formulas
      • Date & Time Formulas
        • DateTime Format Specifiers
        • Timezone specifiers
      • Math Formulas and Operators
      • Logical Formulas & Operators
        • True & False Casting
      • Text Formulas
      • Other Formulas
    • Deduplication
  • ↘️Source Connectors
    • Amazon S3
    • Azure Blob Storage
    • BigQuery
    • Email
    • FTP
    • Google Cloud Storage (GCS)
    • Google Drive
    • Google Sheets
    • HTTP API (Call an Osmos API)
    • HTTP API (Osmos Calls Your API)
    • Osmos Dataset
    • Snowflake
    • Accessing Sources behind firewall
  • ↖️Destination Connectors
    • Amazon S3
    • BigQuery
    • FTP
    • Google Cloud Storage (GCS)
    • Google Drive
    • Google Sheets
    • HTTP API (Call an Osmos API)
    • HTTP API (Osmos Calls Your API)
      • Passing Dynamic Tokens in the API Header
    • MySQL
    • Osmos Dataset
    • PostgreSQL
    • Snowflake
    • Accessing Destinations behind firewall
  • 🗂️Projects
  • ⚙️Administration
    • Email Notifications
  • 🔒Security
  • 📞Support
  • Back to Osmos.io
Powered by GitBook
On this page

Was this helpful?

  1. Developer Docs

Passing Parameterized Fields

This section will guide you on how to programmatically pass values, such as user ID, org ID, and file name, to Uploader fields without displaying these details to the user.

PreviousCustomizing Uploader StylingNextConfiguring Uploader's "Recall" functionality

Last updated 9 months ago

Was this helpful?

Parameterized fields enable the secure and programmatic passing of values to the backend, without exposing those fields to the end user. These fields are often employed to collect supplementary information during an upload process, such as User ID or the Org ID of the person uploading. Since this information is not typically available to the end user, it is retrieved programmatically from the host page session. A key application of parameterized fields, particularly with identifiers like userID and userGroup, is to ascertain the specific user and their organization during file uploads. This approach streamlines the process, eliminating the necessity for distinct uploaders for each organization.

Parameterized fields can be defined by setting `fieldType` in the schema supplied in the Osmos Uploader embed snippet.

Osmos supports four types of parametrized fields:

  • "userID" param field records the identifier of the user who uploads the file

  • "userGroup" param field records the organization ID linked to the user performing the upload

  • "fileName" param field stores the uploaded file's name

  • "constantValue" param field is designed to capture and assign any predetermined custom value to any field.

NOTE: "userID" and "userGroup" are special parameterized field that are also used to personalize functionality.

To learn more about how userID and userGroup can be used to tailor Uploader Recall, visit

These fields are not visible or accessible to the user in any form. If the fieldType for either userID or userGroup is utilized without assigning corresponding values, these fields will automatically default to an empty string.

Note:

  • userID and userGroup param are defined outside the schema

  • fileName param does not need to be defined. It gets populated automatically for any schema field with a fieldType of fileName.

  • constantValue param should be defined inside the schema

Here's an example of using a userID parameterized field which populates a field called user_id for every row by pulling the the property curUserID from the browser.

<script>
  Osmos.configure({
    userID: window.curUserID,
    schema: {
      fields: [
        {
          name: "user_id",
          fieldType: 'userID'
        },
        ...
      ]
    },
    ...
  });
</script>

In this example, we add a return a parameterized named upload_name which is set to the name of the uploaded file.

<script>
  Osmos.configure({
    schema: {
      fields: [
        {
          name: "upload_name",
          fieldType: 'fileName'
        },
        ...
      ]
    },
    ...
  });
</script>

Here's an example of using a parameterized field that fills in the provided constantValue for that field in all rows:

<script>
  Osmos.configure({
    schema: {
      fields: [
        {
          constantValue: '02042022',
          name: "const_field",
          fieldType: 'constantValue'
        },
        ...
      ]
    },
    ...
  });
</script>

An uploader that includes all types of parameterized fields along with four other standard mapped fields, might look like the javascript below. A user of this uploader will be able to map and transform the first four fields listed, and the resulting document written to the destination will contain seven fields total.

<!-- Osmos File Upload Button -->
<!-- See this link for more docs. https://docs.osmos.io/osmos-uploader/webpage-integration -->
<script src="https://cdn.osmos.io/button/embed/v1/OsmosButton.js"></script>
<script>
  Osmos.configure({
  userID: window.curUserID,
  schema: {
    fields: [
      {
        name: "ProductID",
        displayName: "ProductID",
        description: "<Your field description here>"
      },
      {
        name: "FirstName",
        displayName: "FirstName",
        description: "<Your field description here>"
      },
      {
        name: "LastName",
        displayName: "LastName",
        description: "<Your field description here>"
      },
      {
        name: 'paymentType',
        displayName: 'Payment Type',
        description:'The medium of payment which was used to complete the transaction'
      },
      {
        name: "user_id",
        fieldType: 'userID'
      },
      {
        name: "upload_name",
        fieldType: 'fileName'
      },
      {
        constantValue: '02042022',
        name: "const_field",
        fieldType: 'constantValue'
      }
    ]
  },
  token: "example_some_uploader_token_uuid_example",
  uploadDescription: "<Include a description of your uploader upload here which will be shown to users that click the uploader>",
  

  // Set to false to show the schema for the destination connector in the uploader on the file upload screen.
  hideUploadSchema: true,

  // Set to false to show the uploader description on the file upload screen.
  hideUploadDescription: true,

  // Set to false to show the advanced version of the uploader, with formulas, SmartFill, and QuickFixes.
  disableAdvancedMode: true,

  // Maximum number of records displayed in the Uploader UI (User Interface).
  // This value is capped at 100,000 and higher values will default back to 100,000.
  // Can be lowered to increase UI performance when using expensive validators.
  // NOTE: Your file can have >100,000 rows and will be processed fully. There are no limits to how many records can be uploaded.
  //       This setting only limits the number of rows displayed in the UI.
  maxRecords: 100000,

  // Set to true to hide the preview pane screen for CSV files in the uploader.
  hideCSVPreviewPane: false,

});
</script>
<button class="ftl-button" onclick="Osmos.handleClick('w9ziodyyfx4mq6wl2tw1y6dpp6tctfardjeuqsl_n0i-gtsbb')">
  Upload Your Data
</button>
<!-- End Osmos File Upload Button -->
👩‍💻
Uploader Recall
Customize Osmos Recall