0
votes

I am trying to create custom field using Tooling API in Salesforce. First to check Tooling API, I tried using workbench but it is showing following error:

JSON Parser Error: message: Cannot deserialize instance of complexvalue from VALUE_STRING value text or request may be missing a required field at [line:5, column:25] errorCode: JSON_PARSER_ERROR

Following is the JSON body I am using:

{
    "DeveloperName" : "CusField",
    "Metadata":
        {
            "type" : "text",
            "description" : "test",
            "inlineHelpText" : "testhelp",
            "label" : "cus Field",
            "required" : false,
            "precision" : null,
            "length" : 255,
            "unique" : false,
            "externalId" : false,
            "trackHistory" : false
        },
    "TableEnumOrId" : "Account",
    "ManageableState" : "installed"

}

Please let me know what is wrong with body? Thanks in Advance.

1

1 Answers

0
votes

There are a few things wrong with the body.

  • Remove ManageableState
  • Do not include DeveloperName and TableEnumOrId, instead, use FullName as shown below
  • Capitalize the field type Text

Here's a working post body:

{
    "FullName" : "Account.CusField__c",
    "Metadata": {
        "type" : "Text",
        "description" : "test",
        "inlineHelpText" : "testhelp",
        "label" : "cus Field",
        "required" : false,
        "precision" : null,
        "length" : 255,
        "unique" : false,
        "externalId" : false,
        "trackHistory" : false
    }
}