SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any way to get the susbstring from the start of the string until a specific character in a SharePoint designer workflow action? I cannot use "Extract Substring from Start of String" because there isn't a set number of characters I want to copy.

I need to get "1 Year" or "3 Months" from the below strings:

"1 Year|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab"

"3 Months|b553caa2-fww7-4c7f-b84e-22788d26386a"

share|improve this question

migrated from Mar 13 '13 at 14:29

This question came from our site for professional and enthusiast programmers.

has any one got something on above? Please let me know.. additionally NO CODE DEPLOYMENT option.... Thank You. Addtionally my initial part is keep on changing.. i mean it will be like John Cena|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab david mcarther|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab ross kapito|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab – user17734 Jun 20 '13 at 5:11
What version of SharePoint and are you doing a 2010 or 2013 style workflow? – Matthew McDermott May 20 at 13:06

Try this:

1) Find substring in string in which:

  • substring is just the pipe | character
  • string is your metadatafield_0 field
  • output: index1

2) Extract substring from string with length in which:

  • substring is your metadata_0 field from the current item
  • starting location is 0
  • end is the output of the first step (index1)
  • output: substring1

Now log substring1. In my case this results exactly in all characters in front of the pipe character:)

share|improve this answer
I'm unable to find the action "Find substring in string". Is this a default action in SharePoint 2010 (Foundation)? – TempaC Sep 24 '13 at 14:56
Neat- Just done this as a 2013 workflow updating title on a lookup list with a MMS column – westerdaled Dec 15 '14 at 18:15
@TempaC I believe this is only available with SP 2013 Workflows. – punchingInAPepper Jan 28 at 20:46

In Sharepoint 2013 workflow:

1- Find the index of pipe "|" and save it to a variable.

2- Use an action called "Extract Substring from String from Index with Length".

3- Set copy from to be one of your original strings "1 Year|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab" or "3 Months|b553caa2-fww7-4c7f-b84e-22788d26386a".

4- Set copy starting at to be 0.

5- Set for (length) to be the pipe index variable.

The output will be the part of the original string preceding the pip.

share|improve this answer
  • Find substring in string
    enter image description here
    Substring= |
    string=1 Year|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab

    here you will get the index of "|"

  • Now pass that index in Extract string from start of string enter image description here

    replace 0 with your index number, i.e. variable:index1

    string=1 Year|5ff55ee4-5a60-2132-bc02-bbfdd9f190ab

    enter image description here

so you will get your output in variable:substring2 is 1 Year

substring is just the pipe | character string is your metadatafield_0 field output: index1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.