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.
Note:
  • userID and userGroup param are defined outside the schema
  • fileName param does not need to be defined. It gets populated automatically
  • constantValue param should be defined inside the schema
Here's an example of using a parameterized field that fills in the provided userID for that field in all rows.
1
<script>
2
FortyTwoLayers.configure({
3
userID: window.curUserID,
4
schema: {
5
fields: [
6
{
7
name: "user_id",
8
fieldType: 'userID',
9
},
10
...
11
]
12
},
13
...
14
});
15
</script>
Copied!
Here's an example of using a parameterized field that fills in the provided constantValue for that field in all rows:
1
<script>
2
FortyTwoLayers.configure({
3
schema: {
4
fields: [
5
{
6
constantValue: '02042022'
7
name: "const_field",
8
fieldType: 'constantValue',
9
},
10
...
11
]
12
},
13
...
14
});
15
</script>
Copied!
Copy link