Adding/updating values under custom fileds

Hi Team,
I have created custom fields( [cr_call_type, cr_newlead_web, cr_id through DataService.addCustomField but when i tried updating/adding the values under these custom fields i get [DatabaseError]Error updating custom field.

API: XML-RPC:
https://api.infusionsoft.com/crm/xmlrpc/v1

Request:

<?xml version='1.0' encoding='UTF-8'?>

DataService.updateCustomField

<param>

  <value><string>KeapAK-REDACTED</string></value>

</param>

<param>

  <value><int>-1</int></value>

</param>

<param>

  <value><struct>

    <member><name>cr_call_type</name>

      <value><string>answered</string></value>

    </member>

  </struct></value>

</param>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<fault>

    <value>

        <struct>

            <member>

                <name>faultCode</name>

                <value>

                    <i4>4</i4>

                </value>

            </member>

            <member>

                <name>faultString</name>

                <value>[DatabaseError]Error updating custom field</value>

            </member>

        </struct>

    </value>

</fault>

Within your request body you have the custom field Id set as -1. This needs to be a valid (greater than 0) Id for the field you have previously created.

<param>
  <value><int>-1</int></value>
</param>

Hi Justin,

I tried and could update the values under task(information tab) but could not update values for custom fields under (Tech) tab.

Here are the details.
Endpoint: https://api.infusionsoft.com/crm/xmlrpc/v1

Request:

<?xml version="1.0"?>
<methodName>DataService.update</methodName>

<params>

    <param>

        <value>

            <string>KeapAK-REDACTED</string>

        </value>

    </param>

    <param>

        <value>

            <string>ContactAction</string>

        </value>

    </param>

    <param>

        <value>

            <int>96</int>

        </value>

    </param>

    <param>

        <value>

            <struct>

                <member>

                    <name>call_type</name>

                    <value>

                        <string>true</string>

                    </value>

                </member>

            </struct>

        </value>

    </param>

</params>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<fault>

    <value>

        <struct>

            <member>

                <name>faultCode</name>

                <value>

                    <i4>10</i4>

                </value>

            </member>

            <member>

                <name>faultString</name>

                <value>[NoFieldFound]No field found: ContactAction.call_type</value>

            </member>

        </struct>

    </value>

</fault>

Please always remove your API Key before posting code samples! It is important to keep your keys private.

  • All custom field database names begin with an _underscore when referenced in the xmlrpc API.
  • Certain special characters used within the name of a field are never placed in the database name. If you named your field “call_type”, its database name will be “calltype”.

It is likely your corrected xml will look something like:

<name>_calltype</name>

To find your database field names for custom fields there are a 2 ways:

Via the UI:
Navigate to the page where you create your Task custom fields. At the very bottom of the page you will find the link “View the field database names (for the API)”

Via the API:
GET /rest/v1/tasks/model/

I was able to update the text within a custom task field using this code:

<?xml version="1.0"?>
<methodCall>
    <methodName>DataService.update</methodName>
    <params>
        <param>
            <value>
                <string>REDACTED</string>
            </value>
        </param>
        <param>
            <value>
                <string>ContactAction</string>
            </value>
        </param>
        <param>
            <value>
                <int>187</int>
            </value>
        </param>
        <param>
            <value>
                <struct>
                    <member>
                        <name>_TextCustomField</name>
                        <value>
                            <string>Value you are updating to</string>
                        </value>
                    </member>
                </struct>
            </value>
        </param>
    </params>
</methodCall>

Thanks Justin, That helped. Please help with the below too.

  1. Any limitation on the number of custom fields to be created, i see few are not getting updated with values.
  2. How should i updated yes or no for type yes/no. in the below example even though the response is 200 but not seeing the Yes selected.

PFB details.
endpoint:
https://api.infusionsoft.com/crm/xmlrpc/v1
Request:

<?xml version="1.0"?>
<methodName>DataService.update</methodName>

<params>

    <param>

        <value>

            <string>KeapAK-</string>

        </value>

    </param>

    <param>

        <value>

            <string>ContactAction</string>

        </value>

    </param>

    <param>

        <value>

            <int>62</int>

        </value>

    </param>

    <param>

        <value>

            <struct>

                <member>

                    <name>_crnewleadcallrail</name>

                    <value>

                        <string>No</string>

                    </value>

                </member>

            </struct>

        </value>

    </param>

</params>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<params>

    <param>

        <value>

            <i4>62</i4>

        </value>

    </param>

</params>

Thanks in advance.

You are limited to creating 100 custom fields for each Object type. So 100 custom Contact fields, 100 custom Task fields, 100 custom Order fields, etc.

For updating a Yes/No field use 1 and 0 values.

Example to set Yes:

<?xml version="1.0"?>
<methodCall>
    <methodName>DataService.update</methodName>
    <params>
        <param>
            <value>
                <string>apiKey</string>
            </value>
        </param>
        <param>
            <value>
                <string>ContactAction</string>
            </value>
        </param>
        <param>
            <value>
                <int>187</int>
            </value>
        </param>
        <param>
            <value>
                <struct>
                    <member>
                        <name>_YesNoField</name>
                        <value>
                            <string>1</string>
                        </value>
                    </member>
                </struct>
            </value>
        </param>
    </params>
</methodCall>