0

Multiple field values in API calls

When using the Update Documents API calls to update field values or reclassify a document, how do you specify multiple values to a single field?

4 comments

  • Avatar
    Kevin N

    Hi Raphael,

    In the CSV file for the Bulk Update Document API, you can specify multiple values for multiselect fields by enclosing the comma-separated values in a quotation marks.

    For example, against a multiselect picklist:

    id,demo_picklist__c
    152,"value 1,value 2,value 4"

    If using the application/x-www-form-urlencoded method, you can directly specify the comma-separated values:

     

    Thanks,

    Kevin

  • Avatar
    Raphael Goubet

    Thanks, but what if the picklist value contains a comma or, more commonly, spaces?

  • Avatar
    Kevin N

    Hi Raphael,

    For documents, you would have to escape the commas. Spaces generally shouldn't be a problem. For example - let's say you have picklist values of "This is a test" and "THIS,IS,A,TEST":

    id,demo_picklist__c
    152,"This is a test,THIS,,IS,,A,,TEST"

    The embedded commas get escaped as a double comma ",," to signify that the comma is part of the picklist label and not another value for the field.

    Alternatively, you can also escape the whole value with double quotation marks:

    id,demo_picklist__c
    152,"This is a test,""THIS,IS,A,TEST"""

     

    Regards,

    Kevin

  • Avatar
    Raphael Goubet

    Great, thanks Kevin!

Please sign in to leave a comment.