cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Optional inputs disappear if unused

On my 'For a selected file' trigger, I've set up several optional text inputs.  If an input is unused (skipped), it disappears from the triggerBody array. If I try to test the input for content the flow fails because the input no longer exists. I'm left with the message: 

 

'Unable to process template language expressions in action 'Grab_additional_information' inputs at line '1' and column '2103': 'The template language expression 'if(empty(triggerBody()['text_3']),'',triggerBody()['text_3'])' cannot be evaluated because property 'text_3' doesn't exist, available properties are 'entity, text'. Please see https://aka.ms/logicexpressions for usage details.'

 

The triggerBody array needs to be static, with empty values being returned for unused inputs - this way we can use if(empty()) to test for meaningful content without failing the flow. This is a major sticking point for me. The worst part is that the behaviour seems intermittent such that if I copy the optional value into a variable at the start of the flow, sometimes it works and sometimes it doesn't. 

Please sort this out. I'm losing faith.

 

Also - your error messages always seem to state: 'line '1' and column '2103'' regardless of the nature of the error - which means nothing to someone building a flow in the usual manner.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @Anonymous ,

 

Have you set the input as required?

 

Please make sure you have selected Make this field optional, then the flow won’t failed even you don’t give a value for this field.

1.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Highlighted
Community Support
Community Support

Hi @Anonymous ,

 

How long have you left the Input unused?

 

Could you share more details on this issue?

 

According to your description, I have set up the flow with the trigger “For a selected file”, then add two optional Text inputs.

 

Compose with dynamic content Input1.

 

Compose2 with the following code:

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

 

Then I try to trigger the flow several times with Input unused, however, the issue you mentioned doesn’t occur.

1.PNG

 

Please share more details to help reproduce this issue.

 

Best regards,

Mabel  

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Hi,

 

Thanks for your interest.

 

Here's my setup...

Of the inputs shown, only the 'Further information' input is optional. In this case I filled the mandatory inputs and skipped the optional one. If I put information in, it works. If I leave it empty the flow fails.

 

I've had this issue on several occasions with different flows - To resolve it I remove all the inputs, set them up again, and then re initialize the variables - this usually works but will often take several iterations.

 

inputs setup.PNG

 

And here's the outcome...

 

missing input example.PNG

Highlighted

Hi @Anonymous ,

 

Have you set the input as required?

 

Please make sure you have selected Make this field optional, then the flow won’t failed even you don’t give a value for this field.

1.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

I have exactly the same problem. Inputs are strings and are marked as optional.

If I leave it blank when running the flow, the actual item does not exist at runtime, therefore I cannot check it because I cannot even mention it's name without causing an exception.

 

btw did anyone notice that many threads here are marked as having a solution however when you click on "goto solution" it takes you to a post where someone has a footer saying "please Accept this a solution". Maybe you guys should remove or reword that footer so it does not disrupt the system - thanks

 

George

Highlighted

Here is some proof.

First of all it should be noted that the optional field was created as the 1st field, now I find the order inverted

 

f1.PNG

 

leaving the optional field blank and "t2" in the mandatory field....

 

f2.PNG

Highlighted

This is getting wierder and wierder.

I solved the problem using coalesce (which should not happen of course).

coalesce(triggerBody()?['text'],'xxx')
This gives 'xxx' if ['text'] is undefined (it should give an error).
When I implemented this in my real project, it did not work. It gave the error that ['text'] is undefined.
So I used the following laborious solution:
optionalvar1.PNG
where the card on the right is configured to run after if the compose fails.
 
There can be various ways to implement this. This is just one of them.
Comments please
George
Highlighted
Advocate I
Advocate I

I have the same issue. Any comments?

Highlighted
Advocate I
Advocate I

I solved it by checking if the optional input is entered or not with this condition:

 
if(contains(triggerBody(),'email_1'),triggerBody()['email_1'],null)
 
Check optional input.jpg

 

 

Highlighted

@cnavarrete you Guru, you

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Users online (7,947)