cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chase0
Frequent Visitor

Dynamic Content is empty/null when using 'When a HTTP request is received'

I've created a flow that extracts data from a Webhook and works perfectly with dynamic content and then I've created a 2nd flow similar to the 1st but the Dynamic content doesn't work at all they are both very simple flows and I can't figure out what I am doing wrong:

 

Chase0_0-1652459046541.png

 
 

Here is a section of the raw data that has been passed into the 'When a HTTP request is received'

:

Chase0_1-1652459198065.png

and here is the output of the e-mail showing the subject as null but it should be the 'dueOn' from the data above:

Chase0_2-1652459312550.png


The e-mail is being sent but as stated it is blank so I am not getting any errors. I am new to this and I'm hoping it is something simple.

I have tried the same in Zapier and it is working perfectly on that platform.

TIA
Chase



5 REPLIES 5
eliotcole
Super User
Super User

Purely going on the above, it's likely that some of the entries that are received are just blank, so you need to put logic in there that says if it's blank, then do this. That way you can either generate a little error stack for yourself to review and plug the gaps, or you can fill trivial data with a placeholder that makes sense.

 

However I'd say that realistically we'd need to see a bit more (all) of your flow edited in to your initial post, plus the actual error that you're seeing. Screenshots of both (with obfuscations for private data) will be perfect, as they'll help people here support you. 🙂

Chase0
Frequent Visitor

Hey Eliotcole,

thanks for the reply!

In my original post that is my entire flow, its gets info from a webhook and should send an e-mail. As I also stated in the original post my other flow with a slightly different webhook works fine and this particular webhook also works in Zapier.

Also I am not receiving an error I am just getting null information. It sends the e-mail fine but I don't get any of the dynamic content. I will check with the platform runners if the webhook is working correctly but as I can see on the raw data being pulled into the 'When a HTTP request is received' the data is there it just doesn't seem to be going into the dynamic content and as said before its working on Zapier.

I'm not sure what other information I can edit into my original post that isn't already there from the 1st screenshot you can see I am trying to add dueOn into the subject of the e-mail in the 2nd screenshot you can see that dueOn has a date from the data passed in and then on the 3rd screenshot you can see it just says 'null' in the e-mail subject. If you are able to guide me in the right direction of what other information might be useful that would be great!

v-yujincui-msft
Community Support
Community Support

Hi @Chase0 ,

 

If Dynamic content does not work, maybe you could try to write the expression manually.

In addition, you could try to recreate your flow and try it again.

 

 

Best Regards,
Charlie Choi

OK, one of a few things could be off, here, but I think that there are ways to fix all of them relatively easily. But these are still stabs in the dark, if you want to PM me the schema we can double check it.

Make A More Open Schema

Firstly, with your input schema there, make sure that any fields that you want (or all fields) can arrive empty (null).

 

Realistically you'll be fine if that schema is empty, however I see that you're not creating a ton of flow actions to put the logic in the flow. So let's work that schema so that any/all fields can accept a 'null' value.

 

So, quickly check out this answer where you'll see how you can make a field accept given types of response. Here's the dueOn field as an example:

"dueOn": {
  "type": ["string", "null"]
  },

Then your flow will *definitely* run each time, because there's a chance that with null values it might not fully trigger the flow and it won't run at all.

Conditional Logic For Null Values

You should also put in some conditional logic for anything that might be blank something. You can either do this:

  1. Verbose - With Variables and Condition actions that you then use in the email.
  2. Expression - With functions wrapped around those values you're pulling from the trigger.

Verbose Logic

Verbose is my word, here, but essentially this will ensure that if someone comes to this flow in the future, and doesn't understand the Microsoft expression writing language, then they will be able to do maintainance o the flow.

 

Use the Condition action to determine if (for example) dueOn is null. If it is, then set a dueOnVAR Variable to "Due Date Empty" and to perhaps set an emailVAR to change the send address to alert you to an error.

 

Expression Logic

Here you just need to set each field that you care about from the trigger inside an if() function with an equals() function.

 

So, here is the expression that I would use in the Subject field of the email action:

if(equals(triggerBody()?['$dueOn'], null), 'Due On Date Null', string(triggerBody()?['$dueOn']))

I am assuming that the 'dueOn' field is one of the base properties of the input, and I've put belt and braces around that to ensure that it's placed in as text if it exists.

 

Similarly, you could react to any field values that you care about being null with a strong or() statement. So, for example here, I would keep that dueOn expression in the subject, above, but also have this in the 'To' field:

if(
    or(
        equals(triggerBody()?['$dueOn'], null), 
        equals(triggerBody()?['$changeType'], null), 
        equals(triggerBody()?['$description'], null)
    ), 
    'chase@yourcompany.com', 
    'theNormalEmail@yourcompany.com'
)

This example checks the dueOn, changeType, and description, fields, and if any of them are null, it will send you an email telling you about it. I've separated out the lines to make the logic clearer.

 

Obviously with any of these I'm speaking purely via examples, not your literal values, as I don't know the schema.

Incorrectly Set Schema?

Lastly, take a close look at the Schema, when you passed the example data through to it to build it, did it perhaps have something in a field (like numbers only in a field that is usually a string, perhaps) whereby it's expecting the wrong type of information.

 

If I'm thinking right, though, then the flow wouldn't fire ... but still worth checking.

klishb
Regular Visitor

Ever figure this out?  I'm having the same problem.  Maybe I need to work on my handling of null values as well, but my received http request will also provide an inventory# string.  If I test my flow I can see it in the raw output from my http request, but for some reason the very next step doesn't have a value for inventory# in dynamic content when the flow runs.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,849)