Hi team,
How can i loop a result of IMAP node when it returns many attachments.
I want to know the extension of one of the attachments.
When i have one attachment i’m able to get the extension using these line:
item.filename = getBinaryData().attachment_0.fileName;
var name= item.filename.slice(-3);
Thanks in advance
Hey @hermanmaleiane,
You use the code snippet mentioned in our docs: JavaScript Code Snippets | Docs
This will create individual items and you can then process each of them.
1 Like
Hey @hermanmaleiane,
How are you doing? Did you find the solution?
Hi @harshil1712 !!
Thanks for your help. I was able to fix the issue.
1 Like
Thanks, @hermanmaleiane for letting me know! If you can share the solution, it would help other community members!
No problem @harshil1712 .
I’m glad to share.
This code works perfectly
if(Object.keys($binary).length>0){
for(let i in Object.values($binary)){
var type= Object.values($binary)[i]['fileExtension'];
if(type =='eml'){
return type ;
}
}
return '';
}else {
return '';
}
1 Like