Issues with 'Labels' field in Pipedrive v2 Calls in Make

:bullseye: What is your goal?

Need to figure out how to properly supply data to the ‘Labels’ field in Make using the Pipedrive v2 calls.

:thinking: What is the problem & what have you tried?

According to the documentation, it requires an array. In the v1 API we were supplying a comma-delimited string (i.e. ‘31,41’), so I thought that this would work (where 1.labels being said string):

{{split(1.labels; ",")}}

:clipboard: Error messages or input/output bundles

Running a test triggered the following error and forced the scenario to become inactive:

Scenario was deactivated by Make because of reason: Scenario has encountered an error while being processed. Fix the error or clear the queue. The reason is: 400: Validation failed: label_ids[0]: This value should be of type integer.; label_ids[1]: This value should be of type integer.; custom_fields: Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as long text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as long text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as long text custom field value, Expected non-empty 'string' as short text custom field value, Expected non-empty 'string' as short text custom field value (undefined).

I can’t provide a public scenario due to certain data included in it, unfortunately. But the above information I hope should be enough to help. Basically we’re needing an example of how the field data should be properly formatted, as based on Pipedrive’s documentation it should already be in the correct format?

Hello @AirBurners,

Welcome to the Community!

Could you please add a blurred input structure of your Pipedrive module or confirm my theory described below?

Error 1

The reason is: 400: Validation failed: label_ids[0]: This value should be of type integer.; label_ids[1]: This value should be of type integer.

According to your error and documentation, Pipedrive expects an array of integers. Make returns an array of strings.

Pipedrive expects:

[31, 41]

Make’s split function creates:

["31", "41"]

To suggest the best approach for solving this, I would need to learn more about your setup (you can dm me as your workflow contain sensitive informations), but a universal solution is to use the Parse JSON module.

Add Parse JSON module and paste this into JSON string field:

{"list_ids":[
  {{join(split(1.labels; ","); ",")}}
]}

Example: 5.sting is your string with IDs

Error 2

custom_fields: Expected non-empty ‘string’ as short text custom field value

When creating a deal, you must send a request with custom fields containing values.
If the fields are empty, they should not be included in the request body.

To help you debug further, we need your request body structure or information on how you are creating the JSON.

I hope my replies are helpful.
Have a nice day!
Michal

3 Likes

This solved the issue, for the second set of errors it turns out Make was sending over an empty string (or something similar) to Pipedrive which it didn’t like, so I had to wrap each custom value inside an ifempty() function.

3 Likes