Skip to main content

In the legacy workflow designer, I created an Expression to build a SharePoint document link that--when clicked--opened a Word document in the browser (versus downloading it and opening it in Word). I'm rebuilding the workflow now using the modern designer and can't figure out how to create a similar expression. Here's what my expression looks like in the legacy designer:

 

Document Link: Left(Document ID (Link to Document), LengthToComma)

LengthToComma: Find(Document ID (Link to Document), ,) -1

 

I tried setting variables and can get parts of it, but I can't get the LengthToComma formula to work with the "-1" bit at the end. Kept getting character mismatch-type errors. I couldn't find a way to do expressions in the same way in the new workflow designer. 

 

Anyone have any thoughts?

Solved it myself. There's a Function available in the new Workflow Designer called...wait for it...Formula. You can do all the maths in there.

 

I did something like this and then used Document Link as the URL for the Hyperlink function:

Document Link: Left(Document ID (Link to Document), LengthToCommaMinusOne)

LengthToCommaMinusOne: Formula(LengthToComma-1)

LengthToComma: Find(Document ID (Link to Document), ,)

 

What this gives you is a link to a SharePoint document that, when clicked, opens in a browser window instead of downloading the document and opening it in Word. One note about this--you have to turn on the Document ID feature in a Site Collection to make the Document ID (Link to Document) field available for documents in your SharePoint site.


Reply