Email containing a table in the body: placing the table in an HTML field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 11:56 PM
When a table is detected in the inbound email action, how can it be placed in the HTML field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 12:31 AM
What exactly are you trying to do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 12:36 AM
"If a user sends an email to the system containing a table-formatted data in the body, that table should appear in a field ( the field is of HTML type )"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 12:57 AM
Ah, I see. You could try just taking the substring of the table from the body. I made an example script to test in background and you can use it if you change it so that it reads the inbound emails body instead.
Substring uses starting index and ending index and returns the string between those indexes. The indexOf returns the index where the word starts which is why below <table> would be included in the substring, but </table> would be left out. By adding 8 to the ending index we also include </table>, which contains 8 characters. The gs.info should show the whole table, but nothing before or after it. Of course if you have multiple tables in the email only one would be found.
var tableStart = table.indexOf("<table>");
var tableEnd = table.indexOf("</table>") + 8;
var tableString = table.substring(tableStart, tableEnd);
gs.info(tableString);