How to extract URL link from email body using Azure Logic Apps

King Java 500 Reputation points
2024-06-13T22:37:42.2566667+00:00

I have been trying to figure this one out for over last three weeks, and I asked/posted question to the Azure Logic Apps community, but I did not get the solution yet.

So, I am posting here again.

This is summary of my previous post.

Here was my first attempt by following/reading this post:

User's image

So, it appears my pipeline passed until 2nd step (Get emails (V3)), but when it hit the JavaScript Code area, it says "Cannot read property 'body' of undefined".

  1. I got a suggestion to try "var text = workflowContext.actions.Get_emails_(V3).outputsbody. User's image
    1. When I tried that, I got an error saying "Get_emails_' referenced by 'inputs' in action 'Execute_JavaScript_Code' are not defined in the template.'"

User's image

  1. I got a next suggestion to use Regex code like this (on the bottom).

Screenshot showing an example Consumption logic app workflow with the Execute JavaScript Code action.

  1. Also, I got a suggestion to use "When a new email arrives (V3)" instead of "Get emails (V3)" for the second step.

But, I was not able to find "When a new email arrives (V3)" from my Azure Logic App options.

User's image

  1. I tried with the Regex code, and I got this error ('Cannot read property 'body' of undefined'):

User's image

How do I fix to error "Cannot read property 'body' of undefined"?

Thank you!

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,201 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.