Form Field Sets

A Form Field Set is a custom form to be used for bundle and inbox registrations.

Each Form Field Set contains one or more Form Fields. A form and all of its form fields are submitted in a single create request. The order of form fields in the array is the order they will be displayed.

Once created, a form field set can then be associated with one or more bundle(s) and/or inbox(s). Once associated, you will be required to submit well-formatted form-data when creating a bundle-registration or inbox registration.

List Form Field Sets

SDK Method

FormFieldSet.list()

Return Object

FormFieldSet[]

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
user_id
int64
User ID. Provide a value of 0 to operate the current session's user.

Additional Arguments

Example Request

import FormFieldSet from 'files.com/lib/models/FormFieldSet';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const formFieldSets = await FormFieldSet.list({
    user_id: 1,
  });
  for (const formFieldSet of formFieldSets) {
    // Operate on formFieldSet
  }
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Show Form Field Set

SDK Method

FormFieldSet.find()

Return Object

FormFieldSet

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
id
int64
Required
Form Field Set ID.

Example Request

import FormFieldSet from 'files.com/lib/models/FormFieldSet';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const formFieldSet = await FormFieldSet.find(id);
  // Operate on formFieldSet
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Create Form Field Set

SDK Method

FormFieldSet.create()

Return Object

FormFieldSet

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
user_id
int64
User ID. Provide a value of 0 to operate the current session's user.
title
string
Title to be displayed
workspace_id
int64
Workspace ID
skip_email
boolean
Skip validating form email
skip_name
boolean
Skip validating form name
skip_company
boolean
Skip validating company
form_fields
array(object)

Example Request

import FormFieldSet from 'files.com/lib/models/FormFieldSet';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const formFieldSet = await FormFieldSet.create({
    user_id: 1,
  });
  // Operate on formFieldSet
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Update Form Field Set

SDK Method

formFieldSet.update()

Return Object

FormFieldSet

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
title
string
Title to be displayed
workspace_id
int64
Workspace ID
skip_email
boolean
Skip validating form email
skip_name
boolean
Skip validating form name
skip_company
boolean
Skip validating company
form_fields
array(object)

Example Request

import FormFieldSet from 'files.com/lib/models/FormFieldSet';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Find the formFieldSet object by its id.
  const formFieldSet = await FormFieldSet.find(id);
  await formFieldSet.update({
    title: "Sample Form Title",
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Delete Form Field Set

SDK Method

formFieldSet.delete()

Return Object

No return value.

Authorization Requirement

Available to all authenticated keys or sessions.

Example Request

import FormFieldSet from 'files.com/lib/models/FormFieldSet';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Find the formFieldSet object by its id.
  const formFieldSet = await FormFieldSet.find(id);
  await formFieldSet.delete();
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

The FormFieldSet Object

Some of the methods above return a FormFieldSet object. The attributes of this object are listed below.

AttributeDescription
id
int64
Form field set id
title
string
Title to be displayed
form_layout
array(int64)
Layout of the form
form_fields
array(object)
Associated form fields
skip_name
boolean
Any associated InboxRegistrations or BundleRegistrations can be saved without providing name
skip_email
boolean
Any associated InboxRegistrations or BundleRegistrations can be saved without providing email
skip_company
boolean
Any associated InboxRegistrations or BundleRegistrations can be saved without providing company
in_use
boolean
Form Field Set is in use by an active Inbox / Bundle / Inbox Registration / Bundle Registration