Checking for Root of the document library

  • 26 January 2016
  • 4 replies
  • 3 views

Badge +8

Hi,

I need to trigger a workflow only if an item is updated in the Root of the document library and not in the folders.

so for eg: any file that has the URL Path ending with  {serverUrl}/Shared Documents/MyDoc.docx should respond to the workflow

but not the file that has the path

{serverUrl}/Shared Documents/My Folder/MyDoc2.x

I tried the logic like so:

If the URL path Ends with Shared Documents, but it doesn't work. is there any better way of doing this?

Please help,

Thanks,


4 replies

Userlevel 7
Badge +11

Ok so this may do the trick.. At the start of your workflow place a Regular Expression, a collection operation and a Set Condition action.

Create 2 variables, 1 Collection and 1 Number.

In the Reg Ex action set it to "Extract". In the pattern place a /

the Input text should be the Item URL from 'Insert Reference -> Common'

Store results into your collection.

In the Collection Operation action, set this to count. Set the target Collection and store result into your number variable.

In the 'Set a Condition' action, change the condition to "If any value equals value'

In the where section, select Workflow data and the number variable as the operator, select 'Is greater than'

in the second value section, select value and type in the maximum amount of / you should have in your URL EG

http://server/sites/site/shared%20Documents/file.docx (6)

So what will happen is if there are more than 6 / then yes.. Put a End workflow in the branch.

There maybe other ways to do this, this was the first thing to come to mind.

Badge +8

Hi Dan,

thank you for your solution . However, in sharepoint designer workflows, I can achieve this simply by checking if path ends with 'shared documents' and content type ne folder . What  benefit am getting by using nintex in this case?

Userlevel 7
Badge +11

If you can do it in SPD you should be able to do it in NTX. How exactly are you checking the if the URL to the document ends ? I haven't used SPD in so long I can't think of how I'd do it in there..

Badge +8


In SharePoint Designer Workflow I can use a field called "Path" and use the Check "If Path ends with" "Shared Documents" then trigger my workflow.

Reply