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: 0 (TextField), 1 (TextArea), 2 (SelectBox), 3 (CheckBox), 4 (Heading), or 5 (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,
"id": 1234,
"EntityId": 14523423,
"Label": "Birthdate",
"FieldValue": "2020-12-08T17:37:04.5916406Z",
"FieldType": 5,
"Position": 10,
"Mask": ""
}
}
text/xml
<result>
<status>0</status>
<response>
<RelativeItemsCount>0</RelativeItemsCount>
<id>1234</id>
<EntityId>14523423</EntityId>
<Label>Birthdate</Label>
<FieldValue>2020-12-08T17:37:04.5916406Z</FieldValue>
<FieldType>5</FieldType>
<Position>10</Position>
<Mask />
</response>
</result>