Set Variable won't pick up map key pair values?

Set Variable won't pick up map key pair values?

I've created a flow that will extract email content from a message and during testing it shows the map and all the key pair values setup correctly. I add a step to create a new variable to then extract name, email, phone number from the map and they all return null? 
The documentation mentions an option to execute the custom function to then select your data but that doesn't appear for me. Am I doing something wrong? 

  1. string EmailtoVariableParser(string Data)
  2. {
  3. Data = Data.replaceAll("Message from",":Messagefrom:");
  4. Data = Data.replaceAll("Name:",":Name:");
  5. Data = Data.replaceAll("Contact:",":Contact:");
  6. Data = Data.replaceAll("Email:",":Email:");
  7. Data = Data.replaceAll("Message:",":Message:");
  8. Data = Data.replaceAll("This e-mail and any attachments",":::This e-mail and any attachments");
  9. infoArray = toList(Data,":");
  10. SublistData = infoArray.subList(0,10);
  11. contactInfo = Map();
  12. for each  object in SublistData
  13. {
  14. elementIndex = infoArray.indexof(object);
  15. if(elementIndex + 1 < SublistData.size())
  16. {
  17. fieldName = object;
  18. fieldValue = infoArray.get(SublistData.indexof(object) + 1);
  19. //info "Fieldname:" + fieldName;
  20. //info "Fieldvalue:" + fieldValue;
  21. //info "ElementID:" + SublistData.indexof(object);
  22. if(elementIndex.isOdd() = true)
  23. {
  24. //info elementIndex + " is odd";
  25. fieldName = trim(fieldName);
  26. fieldValue = trim(fieldValue);
  27. contactInfo.put(fieldName,fieldValue);
  28. }
  29. }
  30. }
  31. return contactInfo;
  32. }
here is my custom function, 

then setting up a variable I've tried the following values 

${EmailMap.Message}
${EmailtoVariableParser.EmailMap.Message}

both return null 

my end goal is to then use the variables to create a new lead in ZohoCRM 

sample data for function input: Message from Website Contact Page Name: David Beckham Contact: 09897165212 Email: myfavouriteemail@madup.com Message: test This e-mail and any attachments thereto may contain information which is confidential

    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.






                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts





                                                              Manage your brands on social media



                                                                    Zoho TeamInbox Resources



                                                                        Zoho CRM Plus Resources

                                                                          Zoho Books Resources


                                                                            Zoho Subscriptions Resources

                                                                              Zoho Projects Resources


                                                                                Zoho Sprints Resources


                                                                                  Qntrl Resources


                                                                                    Zoho Creator 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


                                                                                              Zoho Show Resources

                                                                                                Zoho Writer

                                                                                                Get Started. Write Away!

                                                                                                Writer is a powerful online word processor, designed for collaborative work.

                                                                                                  Zoho CRM コンテンツ




                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方