cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
westerdaled
Resolver I
Resolver I

Running an approval Flow but only on a certain Content Type Id

Hi

 

I want to trigger a flow in a document library but only for a certain content type. Now I could cheat and use powershell to get the desired content type id but I wondered if there was a dynamic expression I could use

 

I guess my condition would look something like this

@equals(triggerBody()?['ContentTypeId',], '?'')

Has anyone tried this ?

1 ACCEPTED SOLUTION

Accepted Solutions


@v-yamao-msft wrote:

Hi @westerdaled,

 

Do you have a custom column in the library called Content Type Id?

 

If yes, the Condition could be configured likes:

@equals(triggerBody()?['ContentTypeId',], '?')

 

Please take a try with it on your side.

 

 

Best regards,

Mabel Mao


Hi @v-yamao-msftsorry for the confusion.  It turns out that I can use the Content Type Name property as shown below.  I wanted to put a couple of cotnent type in the library but only run the workflow on one type

 

@equals(triggerBody()?['{ContentType}']?['Name'], 'IT Policy')

 

View solution in original post

6 REPLIES 6
v-yamao-msft
Community Support
Community Support

Hi @westerdaled,

 

Do you have a custom column in the library called Content Type Id?

 

If yes, the Condition could be configured likes:

@equals(triggerBody()?['ContentTypeId',], '?')

 

Please take a try with it on your 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.
ScottShearer
Super User III
Super User III

@westerdaled:

 

Let me suggest a simple solution.

 

You might try adding a new site column to the content type.  Set a default value for the site column.  Then, your condition can check for the default site column value.  This column will only have a value if the entry uses the content type to which you added the site column.  You'll probably want to make this a hidden column.

 

Please note that this would not be neccessary if Flow were "content type aware". I added a "Flow idea" for this here - please vote for it if you think it's a good idea.

 

If this solves your issue, please mark your post as solved.

 

Scott

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott


@v-yamao-msft wrote:

Hi @westerdaled,

 

Do you have a custom column in the library called Content Type Id?

 

If yes, the Condition could be configured likes:

@equals(triggerBody()?['ContentTypeId',], '?')

 

Please take a try with it on your side.

 

 

Best regards,

Mabel Mao


Hi @v-yamao-msftsorry for the confusion.  It turns out that I can use the Content Type Name property as shown below.  I wanted to put a couple of cotnent type in the library but only run the workflow on one type

 

@equals(triggerBody()?['{ContentType}']?['Name'], 'IT Policy')

 

View solution in original post

@ScottShearer I like your thinkiing but it looks like the Flow is content type aware - I got it to alert me with the content type name.

I only used Oontent Type Id as this was the first dynamic field I saw in the list.  Turns out I don't need it. 

@westerdaled:  

 

You are correct - content type ID is now available to you.  I believe that this became available within the past few days in my tennant.  When I tested before posting my response, I did not see content type ID or content type name as available in Dynamic properties.

 

I suspect there may be some more good news to come regarding the use of SharePoint content types and Flow.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Would it be less resource intensive to put the condition in the Trigger Condition section of the first action?

@equals(triggerBody()?['{ContentType}']?['Name'], 'IT Policy')

 

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (86,757)