Trying to automate a workflow in which issues with products and the handling of the issues are logged and tracked in an Sharepoint list, all based on emails arriving in a shared mailbox. Initial email arrives in a shared mailbox. In the subject and the body of the email is a reference number (internal ticket number) that needs to be saved in the Sharepoint list. Next an email arrives from an external party referencing the internal ticket number and sharing the external ticket number from that external party in the body of that email. External reference number needs to be saved in Sharepoint list as well for the relevant internal ticket number. This is part of the whole flow. Trying to retrieve the ticket numbers from the internal and external emails. Tried this with GPT prompt action in Power Automate but that does not seem to be a stable solution in the sense that GPT prompt does not seem to recognize the entities. There are several videos where people use a string of compose actions to retrieve data from email body, but I am worried that the reference numbers are not consistently at the same spot in the emails (which is required if one uses the compose actions solution if I am not mistaken?). Can somebody help?
Hi RogerBol,
This situation needs to use some regular expression on the body of the email in order to detect the internal and external ticket number in the external party email.
my first question would be to look if the external ticket number starts with some specific caracter like # or sequential number and the same apply to internal ticket number.
if that is true, then you could use IndexOf functions on the body of your email in order to find the localisation of such caracters and Slice to extract this specific information.
first, insert a compose action with the body of your email in order to see what’s inside the email (triggerOutputs()?[‘body/body’])
Then, in another compose action, in the expression editor slice your body to extract the ticket number. ex.: trim(slice(triggerOutputs()?[‘body/body’],add(indexOf(triggerOutputs()?[‘body/body’],‘#’),1),add(indexOf(triggerOutputs()?[‘body/body’],‘#’),8)))
you will probably need to search for both internal and external ticket number and create item in your sharepoint list among other information that you want to extract from this email.
p.s. IndexOf will indicate the first position of the caracter in the email that you are looking for. If you need the second or third one, the nthIndexOf function might be appropriate. Take a look a Manuel T. Gomes blog on the topics (Power Automate: nthIndexOf function - Manuel T. Gomes)
hope this help and don’t hesitate to write back to get more help
regards,
Jerome