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?
- string EmailtoVariableParser(string Data)
- {
- Data = Data.replaceAll("Message from",":Messagefrom:");
- Data = Data.replaceAll("Name:",":Name:");
- Data = Data.replaceAll("Contact:",":Contact:");
- Data = Data.replaceAll("Email:",":Email:");
- Data = Data.replaceAll("Message:",":Message:");
- Data = Data.replaceAll("This e-mail and any attachments",":::This e-mail and any attachments");
- infoArray = toList(Data,":");
- SublistData = infoArray.subList(0,10);
- contactInfo = Map();
- for each object in SublistData
- {
- elementIndex = infoArray.indexof(object);
- if(elementIndex + 1 < SublistData.size())
- {
- fieldName = object;
- fieldValue = infoArray.get(SublistData.indexof(object) + 1);
- //info "Fieldname:" + fieldName;
- //info "Fieldvalue:" + fieldValue;
- //info "ElementID:" + SublistData.indexof(object);
- if(elementIndex.isOdd() = true)
- {
- //info elementIndex + " is odd";
- fieldName = trim(fieldName);
- fieldValue = trim(fieldValue);
- contactInfo.put(fieldName,fieldValue);
- }
- }
- }
- return contactInfo;
- }
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