0

I have this document library named "Customer Share" and inside it, it contains "Clients" folder >> then inside the Clients Folder we have clients sub-folders.

Now I want to trigger the flow only when files are added to the clients sub-folders:

clet.png

Now I added these 3 Trigger Conditions:

  1. @greater(length(split(triggerOutputs()?['body/{Path}'],'/')),2) // so I can be sure that the file is added inside the customer sub-folder

  2. @greaterOrEquals(indexOf('Customer Share/Clients/',triggerOutputs()?['body/{Path}']),0) // so I can be sure that the sub-folder is under the Clients folder

  3. @equals(triggerOutputs()?['body/{IsFolder}'],false) // only files no folders

johnjohn123_0-1689206372239.png

but the flow will never run.

any advice?

2
  • 1
    Do you want to run flow if new files uploaded directly inside "Clients" folder? Jul 13 at 7:22
  • @GaneshSanap no only insdie the client subfolder such as /clients/clientA/ Jul 13 at 8:43

2 Answers 2

1

You are almost there with your trigger conditions. You just need to slightly adjust your first 2 conditions as explained below:

  1. In your 1st condition, use 3 instead of 2 as array will have more than 3 elements after split:
@greater(length(split(triggerOutputs()?['body/{Path}'],'/')),3)
  1. Syntax of indexOf function is like: indexOf('<text>', '<searchText>'). So, change the parameter positions in your trigger condition like:
@greaterOrEquals(indexOf(triggerOutputs()?['body/{Path}'],'Customer Share/Clients/'),0)

Here are the all 3 trigger conditions working for me:

enter image description here

Also, configure your flow trigger like this:

enter image description here

2
  • ok thanks it worked well now, but can you advice why split(triggerOutputs()?['body/{Path}'] will always generate empty item inside the array? Jul 13 at 8:41
  • 1
    Generally folder path of the file will be like Customer Share/Clients/ClientA/ and when you split this string based on / character, it will return 4 elements including empty item (element after last /). Jul 13 at 8:51
1

You can try following trigger conditions to achieve your requirements

  1. To ensure that file is added insides Clients folder only

    @equals(contains(triggerOutputs()?['body/{Path}'], 'Customer Share/Clients/'), true)

  2. To ensure that file is only added inside Clients/ClientXX folder

    @greater(length(split(triggerOutputs()?['body/{Path}'], '/')), 3)

  3. To ensure only files not folders

    @equals(triggerOutputs()?['body/{IsFolder}'],false)

1
  • ok thanks it worked well now, but can you advice why split(triggerOutputs()?['body/{Path}'] will always generate empty item inside the array beside the other list items?\ Jul 13 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.