Passing Parameterized Fields

In this section you will learn how to pass parameterized fields (user ID, file IS, uploader ID, company ID etc.) that will be invisible to the user.

Parameterized fields can be defined by setting `fieldType` in the schema supplied in the Uploader embed snippet. There are several available options to choose from:

  • "userID" will insert the id of the user doing the upload for that field. The user ID can be supplied either by providing it as a top-level field on the configuration object in the snippet or calling setUserID on the context object.

  • "userGroup" works in the same way as "userID"

  • "fileName" will be populated with the name of the file uploaded by the user

  • "constantValue" will be populated with whatever value is provided in an attribute named constantValue for that same field

These fields will not be visible to the user or accessible by them in any way. If a user ID or user group field is used but no user id or group is set, the fields will default to empty string. Here's an example of using a parameterized field that fills in the provided user ID for that field in all rows:

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

Only non-parameterized rows are included in the passed array. The column indices are such that they correspond to the columns of the table shown to users. Filtering out all parametrized fields while maintaining the order of the remaining fields will yield the expected order.