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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / for a selected file tr...
Power Automate
Unanswered

for a selected file trigger and empty value with non existing variable in json

(0) ShareShare
ReportReport
Posted on by 75

Hi there !

 

So I built a low using this trigger. it's an approval flow, so I request an approver, a comment, a couple of date. The caller can also fill in an optional email  account who should be aware of the approval. 
Then, in the flow I update the Sharepoint library with the data the user filled in. 

Unfortunatelly, If the optional email is left blank, it generate an error. "Bad template. email2 variable don't exist..." (see picture below)

In fact the trigger do not create an internal Variable in the JSON for the non filled-in fields.

 

How can I manage this ? How can I test if the user filled in a field ? Because as soon as I try to refer to it, if it's empty, it failed the flow.


output.pngerror_flow.png

Categories:
I have the same question (0)
  • manuelstgomes Profile Picture
    6,625 on at

    Hi @fsim 

     

    Somewhere in the "Update file properties 4" you have a "email_2", but if you look at the JSON there is no field with that name. Do you mean "email_1"?

     

    Cheers
    Manuel

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • fsim Profile Picture
    75 on at

    @manuelstgomes thanks for your answer

    That's exactly my point: Email_2 will only be in the json if the user filled in the "optional Email" field.

    So I need to check prior the update if the email box was filled or not.

     

  • Verified answer
    manuelstgomes Profile Picture
    6,625 on at

    HI @fsim 

     

    Makes sense. Let's try the following. Create a condition where the left side you have the following formula:

    empty(triggerBody()?['email_2'])

    and in the right equals to true.

     

    Can you please check if and let me know if you have any questions?

     

    Cheers
    Manuel

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • fsim Profile Picture
    75 on at

    @manuelstgomes 

    indeed the  empty () function did not crash the flow despite the email_2 did not exist !
    So I'm good to create 1 variable per field, and update these variable with the value of the fields when they are filled in and with blank() when they are not. 
    Then I will use those new variables in my update.

    right ?

    Or is it a way to put this test directly in the update item ? 

     

    Thanks anyway !

     

     

  • manuelstgomes Profile Picture
    6,625 on at

    HI @fsim 

     

    Yeah that works also. Glad it's working.

     

    Cheers
    Manuel

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • fsim Profile Picture
    75 on at

    for those hwo might come here:
    be aware that  if(empty(triggerBody()['Email_1']),null,triggerBody()['Email_1']) don't work ! Same error than above. You need to use the conditional branch

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
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard