cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misidoro
Level: Powered On

Flow with conditions based on content type or custom properties

Hello,

 

I am trying to create a Flow that moves a document when a new file is created in a document library where column X has a certain value.

 

When using a custom column (from a custom content type), I get this error:


InvalidTemplate
. Unable to process template language expressions for action 'Condition' at line '1' and column '2024': 'The template language expression 'contains(triggerOutputs()['headers']['TipoWorkFlow'], 'Fax')' cannot be evaluated because property 'TipoWorkFlow' doesn't exist, available properties are 'Pragma, Retry-After, x-ms-file-id, x-ms-file-name, x-ms-file-path, x-ms-file-etag, x-ms-request-id, Cache-Control, Date, Location, Set-Cookie, Server, X-AspNet-Version, X-Powered-By, Content-Length, Content-Disposition, Content-Type, Expires, Last-Modified'. Please see https://aka.ms/logicexpressions for usage details.'.

 

Even knowing the custom column I am using is valid (named "TipoWorkflow"), the flow is unable to validate it.

 

I am getting this error:


InvalidTemplate
. Unable to process template language expressions for action 'Condition' at line '1' and column '2024': 'The template language expression 'contains(triggerOutputs()['headers']['TipoWorkFlow'], 'Fax')' cannot be evaluated because property 'TipoWorkFlow' doesn't exist, available properties are 'Pragma, Retry-After, x-ms-file-id, x-ms-file-name, x-ms-file-path, x-ms-file-etag, x-ms-request-id, Cache-Control, Date, Location, Set-Cookie, Server, X-AspNet-Version, X-Powered-By, Content-Length, Content-Disposition, Content-Type, Expires, Last-Modified'. Please see https://aka.ms/logicexpressions for usage details.'.

 

Flow condition is like this:

 

Flow_CTProp_CustomCT.png

 

After that, I tried using Content Type property of the document both using content type name and content type id and althought I dont get an error anymore, the conditions is not verified,

 

Using content type id:

 

Flow_CTProp_CTID.png

 

Using content type name:

 

Flow_CTProp_CTName.png

 

The only way I got a condition to work was using the File name property.

 

Can anyone help?

 

Thanks,

Miguel

 

 

 

 

14 REPLIES 14
Community Support Team
Community Support Team

Re: Flow with conditions based on content type or custom properties

Hi Misidoro,

 

Please try to use “File name” contains .fax in the condition to see if it works.

 

Please check this thread for a reference:
https://powerusers.microsoft.com/t5/Flow-Forum/eMail-Attachments-to-SP-Library-CodeTwo-signature-ima...

 

And about the “Column X”, could you provide more information about this column? Is it a column of the file content or anything else?

 

Best regards,
Mabel Mao

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.
misidoro
Level: Powered On

Re: Flow with conditions based on content type or custom properties

Hello Mabel,

Thanks for the response.

Using filename contais .fax wont work because file names may not contain fax in the name.

Column X is from a custom content type associated with the document library.

It is a choice column.

The thing is that flow interface only shows default properties like File name, file content type, etc and doesnt seem to recognize custom content types and doesnt allow its fields to be used in conditions.

Thanks,
Miguel

misidoro
Level: Powered On

Re: Flow with conditions based on content type or custom properties

Hello Mabel,

Thanks for the response.

Using filename contais .fax wont work because file names may not contain fax in the name.

Column X is from a custom content type associated with the document library.

It is a choice column.

The thing is that flow interface only shows default properties like File name, file content type, etc and doesnt seem to recognize custom content types and doesnt allow its fields to be used in conditions.

 

Any other ideas on how we can create conditions based on custom metadata?


Thanks,
Miguel

Community Support Team
Community Support Team

Re: Flow with conditions based on content type or custom properties

Hi Misidoro,

 

You could get the type of the file by right clicking on the file>Properties>Type of file. Then configure the Condition as FileName contains .(file type).
This condition works on .pdf and .xlsx, I guess it will also work on Fax file.
Please have a try on it.

 

About custom content of document library, it is currently not supported in flow, I have seen an idea at Flow Ideas Forum, please vote this idea at here:
https://powerusers.microsoft.com/t5/Flow-Ideas/Flow-custom-SharePoint-library-columns/idi-p/3344
I will also collect and report this from my side.

 

Best regards,
Mabel Mao

 

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.
misidoro
Level: Powered On

Re: Flow with conditions based on content type or custom properties

Thansk for the reply and the user idea suggestions, I will take a look.

The solution based on file type although can be used in some scenarios, can't really be used in enterprise scenarios where what makes sense is to use custom content types to classify information.

 

Thanks,

Miguel

ianbruckner
Level: Powered On

Re: Flow with conditions based on content type or custom properties

seems like content type values (ID/Name) aren't returning... even though such attributes are showing up as selectable.

Highlighted
ahern1987
Level: Powered On

Re: Flow with conditions based on content type or custom properties

Currently trying to use A custom document set to determine if whether or not a flow should be initiated. Users should not be able to start a flow with a singular document, only when they submit a complete document set.  Does anyone know when Document sets (33761) are going to be modernized?? because it was scheduled for Q1 and we are now in Q2.....  After testing this thoroughly I was able to conclude that we cannot use Content Type as a condition it behaves irregularly.

 

I've tried the following:

  • Custom Content Document Set Types : Invoice Approval
  • Equals: Invoice Approval, Picture, Document, Document Set for parameters Content Type, Content Type Name, Content ID
  • Used a conditional , and tried a switch statement.
  • Used the GUID ID for the content types with and without the 01xGUID prefix
  • Tried inverse logic "if not equal to" document with only other option as "Invoice Approval"
  • Uploading a document will not work either no option to select a content type.
  • Conclusion: Flow does NOT like Content Type as a control condition AT ALL.

Resulting in mostly parameters did not meet criteria email being sent. Which means it's most definitely not seeing any of the content type.

 

 

 

JimmyWork
Level 8

Re: Flow with conditions based on content type or custom properties

We cannot use the Column Content Type, this is not a column we can lookup, it is generated by SharePoint (CAML)

You can make a workaround.

 

Create a choice column that contains the name of each content type, user will have to select this. Then we can lookup that column because it contains data flow can get.

 

Maybe we can use calculated columns, but even calculated columns cannot read from Content Type column.

Im struggeling with this myself, maybe we can use the following (Not Tested yet, will test tomorow)

 

SPREST-Versions (Get the data)

Select and map the column (Content Type)

Create HTML table (If we can see the output here we can use it in a condition.

 

I will type my results tomorow

JimmyWork
Level 8

Re: Flow with conditions based on content type or custom properties

We can extract and run a trigger on specific content type name or id using send http request.

I will update later today again. 

 

I will just try a simple condition like Content type = Document

 

2019-04-18 08_09_03-Run History _ Microsoft Flow.png

JimmyWork
Level 8

Re: Flow with conditions based on content type or custom properties

Seems like a condition works like Content type = Name of content type

 

2019-04-18 08_26_58-Create your flow _ Microsoft Flow.png

JimmyWork
Level 8

Re: Flow with conditions based on content type or custom properties

Using Content type name is equal to Document, this works without any issue just type the name of the content type

Anonymous
Not applicable

Re: Flow with conditions based on content type or custom properties

@JimmyWork 

Can you identify which steps you were using in those screenshots? I was hoping to test this myself.

 

 

JimmyWork
Level 8

Re: Flow with conditions based on content type or custom properties

Here you go.

 

  • When an item is created or modified
  • Send an HTTP request to SharePoint (Named it SPREST-Versions)
  • Select (Data Operations) from array into new array
  • Create HTML table (Data Operation) I use this just to display the result, not needed but good to see what you fetch.

 

Result will be the name of the content type and you can then use a condition Content type is equal to "name of your content type"

 

2019-04-25 10_22_17-Edit your flow _ Microsoft Flow.png2019-04-25 10_25_11-Run History _ Microsoft Flow.png

JimmyWork
Level 8

Re: Flow with conditions based on content type or custom properties

The solution was much more simple.

I use for selected Item because i manually trigger the flow, you can use for created or modified item.

 

2019-04-25 15_45_08-Create your flow _ Microsoft Flow.png

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 326 members 5,474 guests
Please welcome our newest community members: