LeadSquared Developer Centre

ON THIS PAGE

Get Dependent Values of a Custom Activity Drop-down Field


Lets you retrieve all dependent fields for a particular custom activity field’s value. You can also retrieve a specific dependent field by passing the “ChildSchemaName” parameter.
The “ChildSchemaName” and “Paging” parameters are optional.

For example, let’s assume we’ve created an “Example Custom Activity”. This activity has –

  • A parent drop-down field “Country” with values India and China
  • A dependent (child) drop-down field “City” with values Delhi, Bangalore and Beijing, Shanghai. It behaves in the following way –
    • If you select Country=India, the city field will display Delhi and Bangalore
    • If you select Country=China, the city field will display Beijing and Shanghai

Following the example, here’s how you can use this API to retrieve the dependent drop-down values associated with say, India –

  • In the “ParentSchemaName” parameter, pass the schema name of the “Country” field
  • In the “ParentFieldValue” parameter, pass “India”.
  • In the “ChildSchemaName” parameter, pass the schema name of the “City” field.*
  • Pass the “ActivityEventCode” of the “ExampleCustomActivity”.

*If you don’t pass the “ChildSchemaName” parameter, the values of all dependent fields associated with the “ParentFieldValue” will be retrieved.

The response of the example above will return Delhi and Bangalore.

Retrieve Dependendent drop-downs within Custom Field Sets –
You can also retrieve the values of dependent drop-down fields within custom field sets associated with an activity.

  • In the “SchemaName” parameter, pass the schema name of the activity field associated with the custom field set
  • In the “ParentSchemaName” parameter, pass the schema name of the parent drop-down field within the custom field set.
  • In the “ParentFieldValue” parameter pass the value you want to retrieve the drop-down options for.
  • Pass the “ActivityEventCode” of the activity (see Get Activities by Date Range or Get Activities of a Lead).

Here’s an example –

Request Response
{
“Parameter”: {
“SchemaName”: “mx_Custom_1”,
“ParentSchemaName”: “mx_CustomObject_1”,
“ParentFieldValue”: “MP”,
“ActivityEventCode”: 167
},
“Paging”: {
“PageIndex”: 0,
“PageSize”: 10
}
}
{
“DependentFieldsOptionSet”: [
{
“DisplayName”: “City”,
“FieldName”: “mx_CustomObject_2”,
“Options”: [
“Bhopal”,
“Indore”,
“Satna”
]
}
]
}

 

API URL

URL
Icon
POST https://{host}/v2/ProspectActivity.svc/ActivityField/Dependency/Dropdown/Options/Get?accessKey=AccessKey&secretKey=SecretKey

Request

Content-Type: application/json
JSON Body/Payload Icon
{
  "Parameter": {
    "ParentSchemaName": "mx_Custom_1",
    "ParentFieldValue": "Active1",
    "ChildSchemaName": "mx_Custom_2",
    "ActivityEventCode": 156
  },
  "Paging": {
    "PageIndex": 2,
    "PageSize": 1
  }
}

Request Parameters

Parameter Description
ParentSchemaName

Schema Name of the parent drop-down field

ParentFieldValue

The values of the parent drop-down field you want to retrieve associated dependent values for.

ChildSchemaName

Schema name of the dependent drop-down field.

ActivityEventCode

Activity event code of the custom activity. You can find it using the Get Activities of a Lead API.

PageIndex

PageIndex specifies the page number.

PageSize

Specifies the number of results per page.

Response

200 OK
Content-Type: application/json
{
  "DependentFieldsOptionSet": [
    {
      "DisplayName": "child field 1",
      "FieldName": "mx_Custom_2",
      "Options": [
        "child value 2"
      ]
    }
  ]
}

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.