B - PROBLEM :
HTML emails sent to a SharePoint list (incoming email is enabled) in a readable format:
Field Name 1: Field Value 1
Field Name 2: Field Value 2
Field Name 3: 28/02/2018 12:00:00 AM...There are some known issues such as:
- A variable of type "Multiple lines of text" cannot be printed in full at Nintex for review purpose. A test done at the function Log in history list only showed a string of ~250 characters.
- It's not straightforward to replace a character (e.g. new line \n) with a white space.
- The function "Query XML" expects to have an input properly HTML-formatted.
Configuration-wise,
- the feature incoming email must be enabled so that an encrypted email (.eml) can be sent to the list.
- the column "Body" should have the type "Enhanced Rich Text" (or else, a pair of field name & field value will not be in the same line)
Nintex-wise,
Step 1: Get the incoming email body:
Step 2: Strip all unexpected HTML tags, such as: <html>, </html>, <head>, </head>, <body>, </body>, <br>, <p>, </p>, etc ; and append the proper HTML tags to the string.
Step 3: use the function "Query XML" to extract all pairs of name & value, the output should be a collection of lines:
Step 4: count the number of pairs (in terms of the number of lines):
Step 5: at each line, we should (1) remove the special character \n , (2) split the line based on the pattern ":" and save the result in a collection, (3) process the line to find out the value is a string or a date, & (4) assign the value to the proper workflow variable:
Step 6: finally, you can use the workflow variables to create an item at other list with the mapped columns.
D - SOURCE CODE:
Step 1: with the variable Body is multiple lines of text.
Step 2: BodyHTML is multiple lines of text:
Append the proper HTML format:
Step 5: