cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Help building a flow on document upload

Hello all!

 

I'm trying to build a Flow that will start an approval when a document is uploaded to a library. I have a Switch in place that is supposed to evaluate a column called Business Unit for 1 of 3 outcomes. It is a multiple choice column. The problem I keep running into is that I'm getting ExpressionEvaluationFailed and I don't know why.

 

Flow failure messageFlow failure message

 

Below is my entire Flow. I've only started messing with this in the last couple of days, but it seems like it should be easy to do this so I can only conclude that I'm missing something really simple that I don't know about. Any help is greatly appreciated.

 

Entire FlowEntire Flow

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Help building a flow on document upload

Hi @MasterRokku ,

 

Please refer to screenshot below to create the flow:

1.png

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
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

19 REPLIES 19
Highlighted
Super User II
Super User II

Re: undefined

@MasterRokku 

Hi there.  So, it looks like the switch is getting a null value and it doesn't know what to do with that.  I think the best way to fix that will be with Coalesce(), which will let you put a default value if a null comes through.  Something like this:

 

Coalesce(<OriginalBusinessUnitField>,'Unknown')

 

Putting that in the switch condition will replace any null values with 'Unknown' and should ship to your default path on the switch.

 

Keep us posted.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Highlighted
New Member

Re: undefined

The problem is that I don't want it to hit the default path, that's just an error path. I need to figure out how to get switch to read the contents of that column for the workflow to do what I want it to do.

Highlighted
Super User II
Super User II

Re: undefined

Understood, but have you verified there is indeed a value in that field when the document is uploaded?

 

 

Highlighted
New Member

Re: undefined

I've made the field required in SharePoint and I'm putting data in the field when I upload it.  That does make me think though, if it's triggers on upload and the data has to be manually entered into the field then I guess it's probably not there as soon as the document is uploaded and all test after that fail because they're using the same data.

 

Well, now I may have a completely different issue that I'm not sure I know how to solve for. How do I initialize a workflow on document upload that keys on a column that can't be filled out until that document is uploaded? May have painted myself into a corner here.

Highlighted
Super User II
Super User II

Re: undefined

Not necessarily.  You can add a delay after the trigger, or change the trigger to be when a thing is modified (you'll want to add a column showing if the row has already been processed to keep from running older files through, though).

 

The delay might be the best bet.

-Ed-

 

Highlighted
New Member

Re: undefined

So I added a delay action after the trigger, but it looks like I'm still not getting the value of that column into the flow. I've read that since it's a column that has 3 choices that I need to convert it to string data, so I'm using Initialize Variables, but I might be using it wrong. I would think I need to get the values in that column, but I don't know how to get to them.

Highlighted
Super User II
Super User II

Re: undefined

Can you post the output of your trigger from a previous run?  Let's take a look at that.

Highlighted
New Member

Re: undefined

As I'm not super familiar with Flow yet I'm not sure I'm getting all the info I need here.

 

Flowfail3.PNG

Highlighted
Super User II
Super User II

Re: undefined

@MasterRokku 

No worries, we'll sort this out.  Here are a couple of things:

  • Notice how your trigger has "Properties Only"?  I think that means it's not going to pass along any of the data from the actual library list.  Maybe try switching that out for one of the ones that is just "When a file is created" or "When a file is created in a folder".
  • Post a pic of the Initialize Variable step in the edit mode so we can see what you're trying to do there.
  • Run the flow and post the expanded view of the trigger (The same thing you posted from the variable, but from the trigger instead).

We'll get there.  Keep at it.

-Ed-

 

 

Highlighted
Super User II
Super User II

Re: undefined

Hello

 

Flow kicks off as soon as the document is created. This is before it has a value in that field.

 

Please add a Delay say of 1-2 minutes at the top of your flow, then use a get file properties action and happy days it will no longer be null!

Highlighted
New Member

Re: undefined

Made the changes you suggested and it looks like i'm pulling the correct file, so that's more than I had before!

 

flowFail4.PNGFlowFail5.PNGFlowFail6.PNG

Highlighted
Super User III
Super User III

Re: undefined

@MasterRokku I haven't read the entire thread to see the problem but one thing I have noticed from your most recent screenshot is that you are initialising a string variable called Business Unit with nothing as the initial value, but then you are trying to use it immediately in a Switch. That isn't going to work as the variable is empty. You need to use an append to string variable with some value first before you use it in the switch control.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Highlighted
New Member

Re: undefined

Thanks for the reply. Are you saying i need to use the append variable after initialize before switch? I want to make sure I understand as I'm still learning how these functions operate together.

Highlighted
Super User II
Super User II

Re: undefined

i can not see you getting the properties of the file after the delay?

Highlighted
Super User II
Super User II

Re: undefined

also you are not setting any value in the variable you have defined, so of course will always be null too!

Highlighted
New Member

Re: undefined

Ok, I understand why it was returning a null value, that was me expecting more out of a function than it was designed to give.  What the problem seems to be now is that I don't know how to pull the file properties for the specific document that was just uploaded. Seems like I keep pulling all the properties and that's going to make all my approvals go through every time and that's not ideal.

Highlighted
Super User II
Super User II

Re: undefined

Please use the action "Get file properties" from SharePoint and pass the identifier from your trigger.

Highlighted
Community Support
Community Support

Re: Help building a flow on document upload

Hi @MasterRokku ,

 

Please refer to screenshot below to create the flow:

1.png

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
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
New Member

Re: Help building a flow on document upload

Thanks Alice! This one got the job done. I didn't need to pull the whole file, just the properties and then set variables for any of the properties I wanted to use. Thanks again!

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,924)