Recently I was developing a notification workflow that would send an email to a user. For context, I wanted to include the name of the site in the email. I assumed this would be easy enough, but you know what they say about assumptions. 😉
Return the URL and decompose it until only the site name is left.
It’s simple and predictable approach displayed below:
Which worked immediately 🙂
The steps in summary were:
- Set a variable (e.g. SiteName) to equal the current site URL
- Replace the known prefix “https://sharepoint.com/” with a space character
- Then find the first remaining “/” and return its position to an index variable
- Then use the “Extract Substring from index of String” action to return a variable that returns only the Project/Site name from the URL
Note: While developing such a workflow, I return each variable to the history log so I can see what the workflow is doing. I have removed all of these logging lines from the above screenshot in the interest of showing only the key lines in the image.
Call a HTTPs Web Service in combination with a Data dictionary.
It’s more sophisticated – and took me longer to get working due to tweaks that seemed environment specific – although the end result was more satisfying.
The steps were:
- Read Mokhtar Bepari’s comments here
- Build a dictionary
- Call the web service – using the Current Site URL
- Ensure the properties of the Web Service line are as below:
Approach 1 is quick and simple and easy to understand/troubleshoot.
Approach 2 is great for more advanced users but requires a deeper technical knowledge.
Leave a comment and let me know which approach works for you.