LeadSquared Developer Centre

ON THIS PAGE

Create a Custom Lead Field


Lets you create a custom lead field. Pass the custom field’s name, data type and other attributes in the JSON body.

The created field will have the schema name “mx_<Display_Name>”. For example, if you pass the display name as “My Custom Field”, the field will be created with schema name “mx_My_Custom_Field”.

API URL

URL
Icon
POST https://{host}/v2/LeadManagement.svc/CreateLeadField?accessKey=AccessKey&secretKey=SecretKey

Request

Content-Type: application/json
JSON Body/Payload Icon
{
    "DisplayName": "Text Field",
    "DataType": "Text",
    "IsMandatory": false,
    "RenderTypeTextValue": "Textbox",
    "ShowInImport": true,
    "ShowInMailMerge": true,
    "LockAfterCreate": 0,
    "UseInLeadClone": false,
    "MaxLength": "60",
    "OptionsJson": ""
}

Request Parameters

Parameter Description
DisplayName

The display name of the lead field.

DataType

The data type of the lead field. The following values are supported (note that the values are case sensitive) –

  • Text
  • Number
  • Email
  • Phone
  • Website
  • Date
  • Time
  • Select (Dropdown)
  • Boolean
IsMandatory

The mandatory check happens while creating leads through the UI (on lead add forms) and through API calls.

Use “true” or “false” as values.

RenderTypeTextValue

This attribute defines how the field will be rendered. The render type depends on the “DataType” property.  The following values are supported (note that the values are case sensitive). The DataTypes the value can be associated with are shown in brackets.

  • Textbox  (DataType: Text, Number, Phone)
  • TextArea (DataType: Text)
  • Email (DataType: Email)
  • Phone* (DataType: Phone)
  • URL  (DataType: Website)
  • Date (DataType: Date)
  • DateTime (DataType: Date)
  • Time (DataType: Time)
  • RadioButton  (DataType: Boolean)
  • CheckBox (DataType: Boolean)
  • Dropdown  (DataType: Select)
  • SearchableDropdown (DataType: Select)
  • DropdownWithOthers (DataType: Select)

* When using Phone as render type, specify an additional attribute in the JSON body to capture the minimum number of digits in the phone number, “Range_Min”: 10

ShowInImport

Whether the field can be mapped during import. Use “true” or “false” as values.

ShowInMailMerge

Whether the field will be available for mail merge while sending emails. Use “true” or “false” as values.

LockAfterCreate

Whether the field will be editable only for Admin users after a lead is created. Use “true” or “false” as values.

UseInLeadClone

Whether the field’s value should be copied if a lead is cloned. Use “true” or “false” as values.

MaxLength

The maximum length of the field. It should be used when the “DataType” is “Text”, “Select” (Dropdown) or “Email”.

OptionsJson

The list of values when the “DataType” is “Select” (Dropdown).

  • IsDefault – Boolean
  • Value – Text
  • Order – Integer

Example –

"OptionsJson": [
        {
            "IsDefault": false,
            "Value": "Example1",
            "Order": 1
        },
        {
            "IsDefault": false,
            "Value": "Example2",
            "Order": 2
        }
    ]

Response

200 OK
Content-Type: application/json
{
    "Status": "Success",
    "Message": {
        "Id": "f791c285-8a0f-11e6-8f87-22000aa8e760"
    }
}

HTTP Response Codes

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.

On this page

© 2022 by MarketXpander Services Pvt Ltd. All Rights Reserved.