Array of collections: Missing value of required parameter 'value'

I have an automation which import contacts from LinkedIn into Pipedrive CRM.

In Pipedrive CRM in order to create contact I need to specify emails in a form of array of collections, ie something like that:
[{“Label”: “Work”, “Value”: “work@email.com”}]

Value is required fields, but it can be missed in a parent step, which caused to create following invalid object [{“Label”: “Work”, “Value”: null}]

Which consequently caused error

Missing value of required parameter ‘value’.

Is this possible to append to the array of collection dynamically?

Something like that condition would work well.

if ? email : [{"Label": "Work", "Value": email}]

hi @Tim_Sergeev

The error arises due to the absence of the value. You can verify the email’s existence in the history . Additionally, you can implement a filter in the previous module to prevent the error which ensures that it only proceeds if the value exists.

If you could provide a detailed explanation of the issue with a Loom or something similar, we could assist you more effectively.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

2 Likes

Hey @Msquare_Automation ,

Here is the loom explainer of the problem. Hope that helps.

1 Like

@Tim_Sergeev
I think the problem lies within the if condition. Instead of directly specifying the email variable, you should map it within the condition

image

this means if the email is not empty, use the email value, otherwise use null.

2 Likes

Hey @Msquare_Automation,

Unfortunately your previous solution doesn’t work. Here is the reason why I think it fails

Hi Tim,

you can use a Parse a JSON module to create a key-value pair from the email address and use that to make the array (or if the email is empty pass an empty array instead).

Or you can add a router with filters to go to different Create a Person modules depending if the email exists or not.

2 Likes

Hey @Stoyan_Vatov ,

Thank you very much for the detailed answer. It helped me move almost all the way through. However, I can’t figure out the final piece of the puzzle.

It would be great if you could find time to solve it.

Format the JSON string like in this post to create an array directly:

Then you can use the if() formula you have to check if the email is present - if it is, pass the array; and if its not, pass an empty array instead.

2 Likes

Solved! Thanks for a lifesaver recommendation @Stoyan_Vatov. I wouldn’t solve it without you!

2 Likes