2

I am using SharePoint Designer 2010.

I created a workflow in which I needed to test the value of a lookup column. I (perhaps naively) simply tested if the lookup column equals the literal string I was testing for.

It didn't work. So, I slept on it and figured it probably had something to do with how SharePoint handles lookup values. After doing some testing and changing things back and forth it mysteriously started working, WOW!

So, I created another workflow, which needed the same thing to happen. Yet, this time it refused to work :/ So, I log the values it is seeing and observe that instead of returning STRING, the lookup column returns 1;#STRING (where 1 is the ID and STRING is the end user value of the lookup). Now, if I test for 1;#STRING, it works fine.

My question is, why does testing for the nominal value sometimes work (STRING vs 1;#STRING)? What is the secret sauce to convince SharePoint to equivocate the vanilla value of my lookup (STRING) to whatever it is returning in the background?

Obviously, I can work around this several ways:

1) I can use "equals 1;#STRING"

2) I can use "contains STRING"

3) I can use "ends with STRING"

None of these solutions are ideal.

1 seems like the best choice, but since I do not understand why STRING suddenly started working, I can conceive that 1;#STRING may suddenly stop working :(

2 and 3 suffer from returning too many results. (for instance if ASTRING is in the lookup column, it will yield true when I intend for it to yield false).

Ideally, understanding why it sometimes does and does not work would be the best solution. I suspect that when I was tinkering with it, I tripped some bug/feature that caused it to work as initially anticipated.

Finally, I know I am not the only one who has experienced this because when I was searching for answers I came across this question:

Workflow condition using a lookup column

Notice, he too, finds that it wasn't working but then mysteriously was. However, his focus shifted from that issue as it was currently working for him - so no answer for me lies in that thread.

  • As far as I am understanding, you are just highlighting the structure of lookup column. Can you be more specific what you are expecting – Gaurravs Feb 12 '16 at 5:00
  • Sometimes using "if lookup equals value" works. Other times, it requires "if lookup equals 1;#value". Why does the first way work sometimes? Is there a way to make the first way work everytime? – S. Melted Feb 12 '16 at 12:28
0

When you are trying to read the lookup column value in the workflow, have you tried this other option. This returns the look value text only and not the Ids. This one has served me well as i have been using this option for some time now. Do try this and let me know if it helps.

enter image description here

  • For both "if value equals value" and "if current item field equals value" that option is greyed out and blank. i.imgur.com/7e3T9w8.jpg – S. Melted Feb 12 '16 at 12:34
  • I think the if condition may not have this option. Why don't you first pick up the value from the lookup field as shown in my screenshot on to a local worklfow variable, and then apply If condition to the workflow variable.. Do let me know if creating a workflow variable is not a feasible option..??? – Suresh Kumar Senapati Feb 13 '16 at 13:42
  • I think adding the extra step of first storing the value to a workflow variable is probably the way to go. I will come back to report my results after I test it. – S. Melted Feb 16 '16 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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