'Selecting a value for Multi Select field in Zoho CRM

My multi select field has already selection of data. I am trying to run an automation function where it can automatically select the data inside the field already. For my case, i have a multi select field for gender consisting for {male;female}

In my function, after running an if else statement by checking on a digit value, it stores the value of selection

if ( lastdigit.isOdd() == True )
{
gender = "Male";
}
else
{
gender = "female";
}

    update = Map();
    update.put("Gender", gender);
    resp = zoho.crm.updateRecord("Contacts", Contact_ID, update);
    info resp;

but the value of gender multi select field has not been select as either male nor female



Solution 1:[1]

In Zoho, multiselect field value is in List Data type, while in your current code it seems it is String format. Your script should be;

gender_value_as_list = List();
if ( lastdigit.isOdd() == True )
{
    gender_value_as_list.add("Male"); //Make sure Male is in correct spelling in multiselect
}
else
{
    gender_value_as_list.add("Female"); //Make sure Female is in correct spelling in multiselect
}

update = Map();
update.put("Gender", gender_value_as_list);//Make sure Gender is in correct api name for multiselect
resp = zoho.crm.updateRecord("Contacts", Contact_ID, update);
info resp;

Please refer in this article to know more about Zoho/Deluge Data types https://help.zoho.com/portal/en/kb/zoho-crm-platform/deluge-guide-for-zoho-creator/data-types/articles/data-type#Text_data_type

Thanks, Von

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vonjohn