Forum Discussion
jhumphries
Jun 27, 2022Copper Contributor
Use dynamic content within If statement in expression in PowerAutomate
I am using Power Automate to save emails and attachments into a SharePoint Document Library. This is working well, and I now want to automatically apply metadata to the items that are uploaded. ...
- Jun 27, 2022Someone on reddit suggested I turn on the experimental features for powerapps, which allows you to select dynamic content within expressions which answers my question. Thanks!
jhumphries
Copper Contributor
I realised I had syntax problems with my expression. I have now got this line accepted:
if(or(contains(variables('Subject'),'keyword1','1'),variables('Subject'),'keyword2','2'))
However now when I try to save I see this error message:
"Flow save failed with code 'InvalidVariableOperation' and message 'The inputs of workflow run action 'Switch' of type 'Switch' are not valid. The variable 'Subject' must be initialized before it can be used inside action 'Switch'.'."
So many question remains...can I use the dynamic content "Subject" from a "when an email arrives" block in an if expression?
RobElliott
Jun 27, 2022Silver Contributor
Have you initialized the 'Subject' variable and set its initial value?
- jhumphriesJun 27, 2022Copper ContributorSomeone on reddit suggested I turn on the experimental features for powerapps, which allows you to select dynamic content within expressions which answers my question. Thanks!