wix-crm "labels" bug?

Hi there Wixers!

Is this code wrong or did I just found a bug?

export async function buttonSubmitForm_click(event, $w) {
 let contactInfo;
 if ($w("#checkboxSubscribed").checked) {
        contactInfo = {
 "firstName": $w("#inputName").value,
 "lastName": "",
 "emails": [$w("#inputEmail").value],
 "phones": [$w("#inputPhone").value],
 "labels": ["subscribed"],
 "company": $w("#inputCompany").value            
        };
    } else {
        contactInfo = {
 "firstName": $w("#inputName").value,
 "lastName": "",
 "emails": [$w("#inputEmail").value],
 "phones": [$w("#inputPhone").value],
 "company": $w("#inputCompany").value,
        };
    }
    console.log(contactInfo);
     
    wixCRM.createContact(contactInfo)
    .then(res=>console.log(res))
    .catch((err)=> console.log(err)); 
}

Here’s my console log:

{“firstName”:“a”,“lastName”:“”,“emails”:[“a@a.com”],“phones”:[“”],“labels”:[“subscribed”],“company”:“”}

Expected an object, found JString(subscribed) (400)

Hi,
Can you please share a link to your site and specify the name of the page so we can inspect?
Roi.

Here you go Roi (code has not been published on llive site).

The code can be found on the only lightbox from the site. The lightbox is triggered from any of the Products pages. (Try SaaS Cloud Solutions page).

Looking forward to your answer.

Cheers

@Roi any news on this?

Hi Felipe,
The code looks good. the problem is that code can’t be reached because to set two action to buttonPDF
(onClick & link to) element. the link happens before onclick. Choose only one action and it should work.
Roi.

Hi Felipe: Not sure if Roi’s reply solved your problem or not.
One observation I had per your log…
{“firstName”:“a”,“lastName”:“”,“emails”:[“a@a.com”],“phones”:[“”],“labels”:[“subscribed”],“company”:“”}
Expected an object, found JString(subscribed) (400)
It appears to be complaining that the labels property array value of “subscribed” is of the wrong type. I am going to go out on a limb here and suggest that what is really happening is that you do not already have the label “subscribed” as an existing option in the Dashboard CRM. So it’s not that “subscribed” should be an object BUT that it is an unexpected value and the error message is probably set to an earlier error condition in the createContact() logic. Note in the API it states…
labels String[] List of contact’s labels. Labels are used to organize contacts. When setting the labels property, you can only list labels that already exist in your site’s Contacts List .
Anyway, hope you have sorted the problem out.
Steve

Great answer Steve, although 1 year later. I think your assumption is correct and at the time I had not have created the label in the crm. Will consider for future projects.

Best