Update userfield constraints

Last modified on September 11, 2023 at 2:06 pm

Overview

To update the constraints of a userfield, you can send an HTTP PUT request to the userfield URL with a JSON object containing a constraints property with the updated value. The constraints property consists of an object whose properties map costraint types to limit values. When updating this property, all constraints must be provided.

For example, if you have a userfield with minimumLength and maximumLength constraints, and you want to update only the maximumLength constraint value, you must still provide values for both minimumLength and maximumLength in the new constraints property value. If you specify only maximumLength, the constraint value for minimumLength will be cleared, leaving you with only a maximumLength constraint on the userfield.

Note that you are not limited to updating one property at a time; all fields that are valid for a particular userfield type may be updated in a single request. All fields not specified will retain their value. See the Userfield Object Reference for a list of all the object’s fields.

Example

This example shows the request-response sequence when updating the constraints property on a userfield. This will set the minimumValue constraint on the userfield and clear all other constraints.

Request
PUT /dc/api/v5/userfields/8da97a97a92efd18dcbc12876a4510e HTTP/1.1
Host: org.digitalchalk.com
Content-type: application/json
Accept: application/json

{
	"constraints": {
		"minimumValue": 1955
	}
}
Response
HTTP/1.1 204 No Content

References