I am trying to insert new values to an existing picklist field on a custom object via Tooling API. GET works fine but Patch is throwing an error on JSON parsing. I am trying this on workbench before converting to apex.
/services/data/v48.0/tooling/sobjects/CustomField/00N3K000000Mb4F
This is the request payload:
{
"Metadata" : {
"businessOwnerGroup" : null,
"businessOwnerUser" : null,
"businessStatus" : null,
"caseSensitive" : null,
"complianceGroup" : null,
"customDataType" : null,
"defaultValue" : null,
"deleteConstraint" : null,
"deprecated" : null,
"description" : null,
"displayFormat" : null,
"displayLocationInDecimal" : null,
"encryptionScheme" : null,
"escapeMarkup" : null,
"externalDeveloperName" : null,
"externalId" : false,
"formula" : null,
"formulaTreatBlanksAs" : null,
"inlineHelpText" : null,
"isAIPredictionField" : null,
"isConvertLeadDisabled" : null,
"isFilteringDisabled" : null,
"isNameField" : null,
"isSortingDisabled" : null,
"label" : "Test picklist",
"length" : null,
"lookupFilter" : null,
"maskChar" : null,
"maskType" : null,
"metadataRelationshipControllingField" : null,
"populateExistingRows" : null,
"precision" : null,
"readOnlyProxy" : null,
"referenceTargetField" : null,
"referenceTo" : null,
"relationshipLabel" : null,
"relationshipName" : null,
"relationshipOrder" : null,
"reparentableMasterDetail" : null,
"required" : false,
"restrictedAdminField" : null,
"scale" : null,
"securityClassification" : null,
"startingNumber" : null,
"stripMarkup" : null,
"summarizedField" : null,
"summaryFilterItems" : null,
"summaryForeignKey" : null,
"summaryOperation" : null,
"trackFeedHistory" : false,
"trackHistory" : false,
"trackTrending" : false,
"translateData" : null,
"type" : "Picklist",
"unique" : null,
"urls" : null,
"valueSet" : {
"controllingField" : null,
"restricted" : true,
"valueSetDefinition" : {
"sorted" : false,
"value" : [ {
"color" : null,
"default" : false,
"description" : null,
"isActive" : null,
"label" : "First",
"urls" : null,
"valueName" : "First"
}, {
"color" : null,
"default" : false,
"description" : null,
"isActive" : null,
"label" : "Second",
"urls" : null,
"valueName" : "Second"
}, {
"color" : null,
"default" : false,
"description" : null,
"isActive" : null,
"label" : "Third",
"urls" : null,
"valueName" : "Third"
} ]
},
"valueSetName" : null,
"valueSettings" : null
},
"visibleLines" : null,
"writeRequiresMasterRead" : null
},
"FullName" : "Releases__c.Test_picklist__c"
}
The error I keep getting is:
HTTP/1.1 400 Bad Request Date: Tue, 28 Jul 2020 16:33:30 GMT Strict-Transport-Security: max-age=31536002; includeSubDomains Public-Key-Pins-Report-Only: pin-sha256="9n0izTnSRF+W4W4JTq51avSXkWhQB8duS2bxVLfzXsY="; pin-sha256="5kJvNEMw0KjrCAu7eXY5HZdvyCS13BbA0VJG1RSP91w="; pin-sha256="njN4rRG+22dNXAi+yb8e3UMypgzPUPHlv4+foULwl1g="; max-age=86400; includeSubDomains; report-uri="https://a.forcesslreports.com/hpkp-report/00D3K0000000My9m"; Expect-CT: max-age=86400, report-uri="https://a.forcesslreports.com/Expect-CT-report/00D3K0000000My9m" X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block X-Robots-Tag: none X-B3-TraceId: 7c6e83fe5f113bd0 X-B3-SpanId: 7c6e83fe5f113bd0 X-B3-Sampled: 0 Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private Set-Cookie: BrowserId=Efr4ddDwEeqvuAXIuXN_yw; domain=.salesforce.com; path=/; expires=Wed, 28-Jul-2021 16:33:30 GMT; Max-Age=31536000 Sforce-Limit-Info: api-usage=27010/11060000 Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked
[ { "message" : "Cannot deserialize instance of complexvalue from VALUE_NULL value null or request may be missing a required field", "errorCode" : "JSON_PARSER_ERROR" } ]
I am not sure what am I doing wrong here. It works fine for Global picklist value set.
Any help is appreciated.
Thank you.