Updating custom fields of Leads | Community
Skip to main content
Sardor_Taylakov
New Participant
January 10, 2020
Solved

Updating custom fields of Leads

  • January 10, 2020
  • 2 replies
  • 3996 views

I store leads and get get leads by, for example, email by making a GET request to /rest/v1/leads.json?filterType=email&filterValues=example@example.com endpoint. I get the following as a result:

{
    "requestId""212121",
    "result": [
        {
            "id": 121212,
            "firstName""First",
            "lastName""Last",
            "email""example@example.com",
            "updatedAt""2020-01-10T17:16:38Z",
            "createdAt""2020-01-10T17:11:11Z"
        }
    ],
    "success"true
}

From here I can get the id of a lead. So I want to update a custom field this lead has (let's call it allowedToEmail). I can also get details about it by making a GET request to /rest/v1/leads/describe.json endpoint:

{
            "id": 21,
            "displayName""Allowed to email",
            "dataType""boolean",
            "soap": {
                "name""allowedToEmail",
                "readOnly"false
            },
            "rest": {
                "name""allowedToEmail",
                "readOnly"false
            }
        }

What I want is to update its value to false, making a POST request to /rest/v1/leads.json with the following body does is not working:

{
    "action": "updateOnly",
    "input": [
        {
            "id": 4788743,

            "allowedToEmail": false
        }
    ]
}   

Any ideas on how this can be achieved? I greatly appreciate your help.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

You left out the 

lookupField

property.

Look more closely at the required payload.

2 replies

SanfordWhiteman
New Participant
January 10, 2020

The lookup field is id.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
January 10, 2020

You left out the 

lookupField

property.

Look more closely at the required payload.

Sardor_Taylakov
New Participant
January 10, 2020

Doing this does not help:

{
    "action": "updateOnly",
    "input": [
        {
            "id": 4788743,
            "membership": {
                "allowedToEmail": false
            }
        }
    ],
    "lookupField": "allowedToEmail"
}   

The error message is the following:

{
    "requestId""db2a#16f916cd626",
    "success"false,
    "errors": [
        {
            "code""1011",
            "message""Lookup field 'allowedToEmail' not supported"
        }
    ]
}
I am getting the impression that what I am trying to do is not possible via exposed APIs. Could you please confirm if I am right or whether this is under assets?
I appreciate your time and effort.
SanfordWhiteman
New Participant
January 10, 2020

I am getting the impression that what I am trying to do is not possible via exposed APIs. 

Of course it’s possible to update lead fields!