Zoho Flow not handling Boolean properly

Zoho Flow not handling Boolean properly

Hi, I have a checkbox in one system that I'm trying to sync with a checkbox in Zoho CRM. The value from the source system comes in as blank (unticked) or 1 (ticked). I've written the following custom function to convert the output to either boolean false or true. The output from the function looks correct, however in the next step where I map the function output as an input into the Zoho CRM contact update, it returns the following error:
 
Zoho CRM says "Invalid input for Marketing_Email_Allowed. The expected input type is boolean."

As far as I can tell it is already a boolean field with the correct values in it. Can any one help with why CRM is rejecting it?

Custom Function:

bool SetEmailOptIn(string WebHookEmailOptIn)
{
if(WebHookEmailOptIn == "")
{
return false;
}
else if(WebHookEmailOptIn == "0")
{
return false;
}
else
{
return true;
}
}

Output from Actions:

From Web Hook: "amp__isOptedInToMarketingEmails": 1,
Input into Custom Function: "WebHookEmailOptIn": 1
Output from Custom Function: "setEmailOptIn_3": true
Input into CRM contact update: "Marketing Email Allowed": true,
Output from CRM contact update: Zoho CRM says "Invalid input for Marketing_Email_Allowed. The expected input type is boolean."

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now