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.
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 Uploader Recall functionality.
To learn more about how userID and userGroup can be used to tailor Uploader Recall, visit Customize Osmos Recall
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
anduserGroup
param are defined outside the schemafileName
param does not need to be defined. It gets populated automatically for any schema field with afieldType
offileName
.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.
In this example, we add a return a parameterized named upload_name
which is set to the name of the uploaded file.
Here's an example of using a parameterized field that fills in the provided constantValue
for that field in all rows:
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.
Last updated