web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Switch function and nu...
Power Automate
Unanswered

Switch function and null values

(1) ShareShare
ReportReport
Posted on by 74

Hello,

 

I'm trying to use a switch function based on some Dataverse data/lookup field, however some of the data values are null. I've read that I could use the coalesce function here, but I can't seem to get the syntax correct. 

 

I'm pulling rows from Dataverse using List Rows from a specific table. 

Here's my coalesce function in a Compose operation:
coalesce(outputs('List_rows')?['expint_billingbccompany'], 'No Company') 

 

Then in to the switch function I have 4 different environments that are being pulled via their integer ID from lookup in Dataverse

Env1 0000000, Env2 000001, Env3 000002, Env4 000003 (not sure if this is relevant)

 

My flow runs through the first 7 records, regardless of environment, then fails on the 7th because the company is null. I've verified this in the Dataverse table. I could filter out null values in the list rows, but we may want to capture that data at some point and would like to know how. I hope this makes sense. Let me know if anyone needs clarification. 

Categories:
I have the same question (0)
  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Re: Switch function and null values

    Have you tried using the default option in the switch to handle instances where it is null?

  • swebb111 Profile Picture
    74 on at
    Re: Switch function and null values

    Sort of. I put the coalesce function in there, but it was still erroring out saying that the value was null instead of a string/int

  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Re: Switch function and null values

    I wouldn't put anything in the default option unless you need to do something if the value is null. 

  • swebb111 Profile Picture
    74 on at
    Re: Switch function and null values

    Unfortunately it still throws an error stating that the value that originally triggers the switch case is null. 

  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Re: Switch function and null values

    For the value in the Switch, use an expression to check if the value is null and return some other value so you can handle it in the switch. For example from a manually triggered flow where a text value is optional:

    if(empty(triggerBody()?['text']),'Empty',triggerBody()?['text'])

     

  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Re: Switch function and null values

    Can you show your flow, that will probably help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard