0

I'm working with the Salesforce REST API (version 41.0), and I have a MultiPicklist field in Salesforce on the Opportunity object. It has 5 possible values: Bierschbach, Black, Espeland, Hirsi, Meador.

The field does indicate that it should "Restrict picklist to the values defined in the value set", but it does not have a default value.

I have been posting values to this field via the API like this: Bierschbach;Black;Hirsi as the API seems to want.

The API consistently returns this error:

URL: https://myinstance.salesforce.com/services/data/v41.0/sobjects/Opportunity

Message: bad value for restricted picklist field: Bierschbach

Code: 400

I've been trying to use this help link to determine why I can send one or more of the values that are defined as accepted values but have them rejected. The Opportunity object does not require anything with this field automatically, as far as I can tell.

I've noticed this issue in Python and PHP, in case that is relevant:

  • Python code: list_values = ";".join(form.getlist('list_field'))
  • PHP code: $list_values = implode( ';', $object['list_field'] );

What else can I be looking for? It seems like the issue must be in our Salesforce configuration, but perhaps there's something I am neglecting to send with the values?

Update: here's a more full example of what I'm sending to Salesforce:

  • API path: sobjects/Opportunity
  • Method: POST
  • params:

    Array( [Name] => test opportunity [Opportunity_Subtype__c] => Donation: Individual [Member_benefit_special_thank_you_list__c] => Bierschbach;Black;Espeland [CloseDate] => 2017-12-22 [StageName] => Closed Won [Type] => Donation [Datetime__c] => 2017-12-31T05:00:00+00:00 [RecordTypeId] => 012F00000013GkqIAE )

I don't seem able to get that array to format nicely with indenting, but these are all the values that are being sent to the API.

As you can see there is a RecordTypeId, which specifies which kind of opportunity the record is, but it does not have any default values for the list I'm trying to send.

8
  • 2
    Can we see a little more of the payload you're sending? Dec 19, 2017 at 22:16
  • @SebastianKessel Sure, I updated the post with what I'm sending in the request. Dec 19, 2017 at 22:43
  • Check if the Bierschbach picklist value in Salesforce has a leading or trailing space. Dec 20, 2017 at 3:46
  • 2
    Are the picklist values also limited by recordtype? If so maybe the one that is giving you an issue is not available for that recordtype
    – Eric
    Dec 20, 2017 at 4:55
  • 1
    I’ll put it as an answer later today. Glad it helped
    – Eric
    Dec 20, 2017 at 20:31

1 Answer 1

2

Most likely the picklist values are limited by recordtype? If so maybe the one that is giving you an issue is not available for that recordtype

go to Customize -> Opportunities -> Record Types -> Default (and the other types) -> the picklist -> Edit, and move Available Values over to Selected values

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .