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.
Solved! Go to Solution.
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.
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.
@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.
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.
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 !
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.
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
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
72 | |
27 | |
22 | |
15 | |
13 |
User | Count |
---|---|
139 | |
42 | |
42 | |
35 | |
30 |