POST api/2.0/crm/{entityType}/customfield
Creates a new custom field with the parameters (entity type, field title, type, etc.) specified in the request.
Name |
Description |
Type |
Example |
entityType
sent in url
|
Entity type
Allowed values: contact, person, company, opportunity, case
|
string
|
some text
|
label
sent in body
|
Field title
|
string
|
some text
|
fieldType
sent in body
|
Custom field type
Allowed values: TextField, TextArea, SelectBox, CheckBox, Heading or Date
|
number
|
1234
|
position
sent in body
|
Field position
optional
|
number
|
1234
|
mask
sent in body
|
Mask
Sent in JSON format only
optional
|
string
|
some text
|
Data transfer in application/json format:
1) Creation of the TextField custom field:
data: {
entityType: "contact",
label: "Sample TextField",
fieldType: 0,
position: 0,
mask: {"size":"40"} // This is the TextField size. All other values are ignored.
}
2) Creation of the TextArea custom field:
data: {
entityType: "contact",
label: "Sample TextArea",
fieldType: 1,
position: 1,
mask: '{"rows":"2","cols":"30"}' // This is the TextArea size. All other values are ignored.
}
3) Creation of the SelectBox custom field:
data: {
entityType: "contact",
label: "Sample SelectBox",
fieldType: 2,
position: 0,
mask: ["1","2","3"] // These are the SelectBox values.
}
4) Creation of the CheckBox custom field:
data: {
entityType: "contact",
label: "Sample CheckBox",
fieldType: 3,
position: 0,
mask: ""
}
5) Creation of the Heading custom field:
data: {
entityType: "contact",
label: "Sample Heading",
fieldType: 4,
position: 0,
mask: ""
}
6) Creation of the Date custom field:
data: {
entityType: "contact",
label: "Sample Date",
fieldType: 5,
position: 0,
mask: ""
}
application/json
{
"status": 0,
"response": {
"relativeItemsCount": 0,
"entityId": 14523423,
"label": "Birthdate",
"fieldValue": "2022-08-11T22:56:18.2367691Z",
"fieldType": 5,
"position": 10,
"mask": "",
"id": 0
}
}
text/xml
<result>
<status>0</status>
<response>
<relativeItemsCount>0</relativeItemsCount>
<entityId>14523423</entityId>
<label>Birthdate</label>
<fieldValue>2022-08-11T22:56:18.2367691Z</fieldValue>
<fieldType>5</fieldType>
<position>10</position>
<mask></mask>
<id>0</id>
</response>
</result>