---
title: Create a Custom Field
slug: create-a-custom-field
docTags: 
createdAt: 2026-10-12T16:38:28.335Z
---

{
  "id": "JMz5iuyEyLQ3RSCT4_ptB",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/cpq/objects/{objectName}/custom-fields",
    "servers": [
      {
        "url": "https://api.nue.io/cpq/objects/{objectName}/custom-fields",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/cpq/objects/{objectName}/custom-fields",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Create a Custom Field",
    "description": "<p>Create a custom field on a Nue-supported object in Salesforce and make it usable in Nue in one call. The steps run in this order: create the field and add it to the object's Fields Expose to Nue field set plus any field sets listed in fieldSets; grant read and edit access to the permission sets named in permissionSetIds or permissionSetNames; then synchronize Nue's custom field metadata. Access is granted before the synchronization so that Nue records the field as editable. Name at least one permission set. A field that no permission set can see is invisible: it does not appear in the line editor and cannot be picked as a line attribute's mapped field. To grant access later, use POST /cpq/field-permissions. The field's api name is resolved by Salesforce: supply the base name and the org applies its own namespace prefix and the __c suffix. Creating a field that already exists on the object is not an error: it is reported as existing and left unchanged, provided its type and size can hold what was requested.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "objectName",
          "type": "string",
          "example": "",
          "description": "<p>The Nue object to create the field on, e.g. PriceBookEntry</p>"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json",
            "*/*"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "example": "",
          "description": "",
          "customType": "CreateCustomFieldRequest",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "<p>Base name of the field, without a namespace prefix or the __c suffix, e.g. PO_Number. Salesforce resolves the full api name — an org that owns a namespace prefixes it — and returns it.</p>",
              "example": "",
              "minLength": 0,
              "maxLength": 40
            },
            {
              "name": "label",
              "kind": "optional",
              "type": "string",
              "description": "Field label shown in Salesforce. Defaults to the name with underscores replaced by spaces.",
              "example": "",
              "minLength": 0,
              "maxLength": 40
            },
            {
              "name": "type",
              "kind": "required",
              "type": "string<Text | LongTextArea | Checkbox | Number | Currency | Percent | Date | DateTime | Email | Phone | Url | Picklist | MultiselectPicklist>",
              "description": "<p>Field type. Determines which of length / precision / scale / picklistValues are required.</p>",
              "example": "",
              "enum": [
                "Text",
                "LongTextArea",
                "Checkbox",
                "Number",
                "Currency",
                "Percent",
                "Date",
                "DateTime",
                "Email",
                "Phone",
                "Url",
                "Picklist",
                "MultiselectPicklist"
              ]
            },
            {
              "name": "length",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "Maximum length. Required for Text and LongTextArea.",
              "example": "",
              "format": "int32"
            },
            {
              "name": "precision",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "<p>Total number of digits. Required for Number, Currency and Percent.</p>",
              "example": "",
              "format": "int32"
            },
            {
              "name": "scale",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "<p>Number of digits after the decimal point. Required for Number, Currency and Percent.</p>",
              "example": "",
              "format": "int32"
            },
            {
              "name": "visibleLines",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "Number of lines shown in the editor. Required for LongTextArea and MultiselectPicklist.",
              "example": "",
              "format": "int32"
            },
            {
              "name": "picklistValues",
              "kind": "optional",
              "type": "array",
              "description": "<p>The values of a Picklist or MultiselectPicklist. Required for those types, ignored otherwise.</p>",
              "modelRef": "#/components/schemas/PicklistValueRequest",
              "customType": "PicklistValueRequest[]",
              "schema": [
                {
                  "name": "value",
                  "kind": "required",
                  "type": "string",
                  "description": "The stored value",
                  "example": ""
                },
                {
                  "name": "label",
                  "kind": "optional",
                  "type": "string",
                  "description": "The label shown to users. Defaults to the value.",
                  "example": ""
                }
              ]
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "Description recorded on the field in Salesforce.",
              "example": "",
              "minLength": 0,
              "maxLength": 255
            },
            {
              "name": "inlineHelpText",
              "kind": "optional",
              "type": "string",
              "description": "Help text shown next to the field in Salesforce.",
              "example": "",
              "minLength": 0,
              "maxLength": 255
            },
            {
              "name": "required",
              "kind": "optional",
              "type": "boolean",
              "description": "<p>Must be false or omitted. A new field cannot be created as required: existing records have no value for it, so every write that does not set it would fail. Create the field as optional, and make it required in Salesforce Setup once every record has a value. Reusing a field that is already required is still allowed.</p>",
              "example": ""
            },
            {
              "name": "defaultValue",
              "kind": "optional",
              "type": "string",
              "description": "Default value for the field.",
              "example": ""
            },
            {
              "name": "fieldSets",
              "kind": "optional",
              "type": "array",
              "description": "<p>Field sets the field should join, by api name, developer name or label. \"Fields Expose to Nue\" is always added and does not need listing. A field set the object does not have is reported in fieldSetOutcomes rather than failing the request - field sets are not uniform across objects. Read the object's inventory from GET /cpq/objects/{objectName}/field-sets.</p>",
              "example": "[\"Nue Custom Fields\"]",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "[\"Nue Custom Fields\"]",
              "itemDefault": ""
            },
            {
              "name": "permissionSetIds",
              "kind": "optional",
              "type": "array",
              "description": "<p>Ids of the permission sets to grant read and edit access through. Granting happens before Nue's metadata is synchronized, which is why it belongs on this request rather than in a follow-up call: a field synchronized while unpermissioned is recorded read-only in Nue permanently.</p>",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "permissionSetNames",
              "kind": "optional",
              "type": "array",
              "description": "<p>Permission set names or labels, resolved tolerantly. A name matching more than one permission set is rejected rather than guessed at.</p>",
              "example": "[\"Deal Desk\"]",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "[\"Deal Desk\"]",
              "itemDefault": ""
            },
            {
              "name": "readable",
              "kind": "optional",
              "type": "boolean",
              "description": "Whether the granted permission sets can read the field. Defaults to true.",
              "example": ""
            },
            {
              "name": "editable",
              "kind": "optional",
              "type": "boolean",
              "description": "Whether the granted permission sets can edit the field. Defaults to true. Edit access requires read access.",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/CreateCustomFieldRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "The field exists on the object and Nue has been synchronized",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "",
            "description": "",
            "customType": "CreateCustomFieldResponse",
            "schema": [
              {
                "name": "objectName",
                "kind": "optional",
                "type": "string",
                "description": "The Nue object the field was created on",
                "example": ""
              },
              {
                "name": "fieldApiName",
                "kind": "optional",
                "type": "string",
                "description": "<p>The resolved Salesforce api name of the field, including any namespace prefix the org applies</p>",
                "example": ""
              },
              {
                "name": "fieldCreated",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether the field was created. False when it already existed.",
                "example": ""
              },
              {
                "name": "fieldExisted",
                "kind": "optional",
                "type": "boolean",
                "description": "<p>Whether the field already existed on the object, in which case it was left as-is</p>",
                "example": ""
              },
              {
                "name": "addedToFieldSet",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether the field is a member of the object's \"Fields Expose to Nue\" field set. A field outside that field set is not visible to Nue.",
                "example": ""
              },
              {
                "name": "syncedToNue",
                "kind": "optional",
                "type": "boolean",
                "description": "<p>Whether Nue's custom field metadata was re-synchronized from Salesforce after the change</p>",
                "example": ""
              },
              {
                "name": "fieldPermissionsGranted",
                "kind": "optional",
                "type": "boolean",
                "description": "<p>Whether any profile or permission set can see the new field, checked after the grant. When false nothing can see it: it cannot be selected in field pickers or edited on a record, and the synchronization that follows will have recorded it read-only in Nue. Supply permissionSetIds or permissionSetNames on the request to avoid this.</p>",
                "example": ""
              },
              {
                "name": "visibleToNue",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether Nue's integration user can see the field. False means Nue itself cannot read or write it until it is granted through a permission set that user holds. Null when it could not be checked",
                "example": ""
              },
              {
                "name": "fieldSetOutcomes",
                "kind": "optional",
                "type": "map",
                "description": "<p>Field-set api name -> null when the field is a member of it, or the reason it is not. A field set the object does not have appears here with that reason; it does not fail the request.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "fieldSetsJoined",
                "kind": "optional",
                "type": "array",
                "description": "Api names of the field sets the field now belongs to.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "warnings",
                "kind": "optional",
                "type": "array",
                "description": "<p>Non-fatal notes about work that did not complete, such as a field set the object does not have. The field itself exists whenever this response is returned.</p>",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              }
            ],
            "modelRef": "#/components/schemas/CreateCustomFieldResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>The object is not one Nue synchronizes custom fields for, the field definition is incomplete for its type, or Salesforce refused to create the field</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "501",
        "description": "<p>The tenant is not Salesforce-integrated</p>",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "7X82SNnxsVpxeJBikJt5J",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/cpq/objects/{objectName}/custom-fields \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"name\": \"\",\n     \"type\": \"\",\n     \"picklistValues\": [\n     {\n     \"value\": \"\"\n     }\n     ]\n     }'"
        },
        {
          "id": "xHu1g2ZsHaVfoECOfngXC",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"name\": \"\",\n   \"type\": \"\",\n   \"picklistValues\": [\n      {\n         \"value\": \"\"\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/cpq/objects/{objectName}/custom-fields\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "nUtzx9iLuvMRtUOVGE2Fd",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/cpq/objects/{objectName}/custom-fields\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"\",\n   \"type\": \"\",\n   \"picklistValues\": [\n      {\n         \"value\": \"\"\n      }\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "n7ePhwrW55qD4R8bWUA8U",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/cpq/objects/{objectName}/custom-fields\"\n\npayload = json.dumps({\n   \"name\": \"\",\n   \"type\": \"\",\n   \"picklistValues\": [\n      {\n         \"value\": \"\"\n      }\n   ]\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "7X82SNnxsVpxeJBikJt5J"
    },
    "results": {
      "languages": [
        {
          "id": "GYDaHc5R4hhVNbOoyM4su",
          "language": "201",
          "code": "// The field exists on the object and Nue has been synchronized\n{\n  \"objectName\": \"\",\n  \"fieldApiName\": \"\",\n  \"fieldCreated\": false,\n  \"fieldExisted\": false,\n  \"addedToFieldSet\": false,\n  \"syncedToNue\": false,\n  \"fieldPermissionsGranted\": false,\n  \"visibleToNue\": false,\n  \"fieldSetOutcomes\": \"\",\n  \"fieldSetsJoined\": [\n    \"\"\n  ],\n  \"warnings\": [\n    \"\"\n  ]\n}"
        },
        {
          "id": "gnfayAMk5SN1863-AW_Sn",
          "language": "400",
          "code": "// The object is not one Nue synchronizes custom fields for, the field definition is incomplete for its type, or Salesforce refused to create the field\n"
        },
        {
          "id": "R0oodHaWDdIwym3VnvgAm",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "jPMxUYzIqbR4Bbfw3iJb-",
          "language": "501",
          "code": "// The tenant is not Salesforce-integrated\n"
        }
      ],
      "selectedLanguageId": "GYDaHc5R4hhVNbOoyM4su"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}