3

I'm working on a simple workflow in SPD 2010 which is going to send an email to multiple recipients based on lookup values and even though I set the "Return Field As Lookup Values, Comma Delimited" I'm still getting the lookup id just after the lookup value like this:

[email protected];#23 -> everything works fine though, the recipient gets the email

If the workflow will add 2 lookup values the field looks like this:

[email protected];#23;[email protected];#24 -> end result in nothing, the workflow gets canceled.

Is there a way to get rid of the lookup id?

EDIT: The value I'm retrieving with the lookup are "email addresses, semicolon delimited"

I've tried to create a local variable to store the lookup values (in order to return it as "email addresses, semicolon delimited", but when I set the variable value to the lookup value I can only return it as "String", "Lookup Value, comma delimited" and "Lookup Ids, comma delimited" which makes the local variable unable to return it as the intended type.

I'm getting a "coercion failed" error.

9
  • So, I take it the lookup is multi-choice lookup based on your example. Is the lookup also getting the ID as well? The problem I see is that it is not using commas to separate, but semicolons which doesn't help for using string functions. Is there not a place to actually select the separator? Commented Oct 3, 2014 at 9:51
  • I'm getting the ID at the end of the lookup value. Seems that at some point its being converted to Text and showing the lookup ID. Now I'm wondering if I just change the delimiter for those email adresses manually, will that solve the problem. Commented Oct 3, 2014 at 10:16
  • I have tested your case, and everethyng works fine with "Return Field As: Lookup Values, Comma Delimited" in "To" Field. How have got the actual value passed to email activity? Commented Oct 3, 2014 at 10:21
  • I'm adding the value by "Workflow Lookup for a User". Commented Oct 3, 2014 at 10:36
  • Maybe this will help. 1 lookup value may have 1 or 2 email addresses which are going to be semicolon delimited, if the workflow adds 2 lookup values the returned values are like this: '[email protected];[email protected];#45;[email protected];[email protected];#46' Commented Oct 3, 2014 at 11:05

3 Answers 3

1

You should use

Return as email id semicolon delimited

That way there would be no lookup id.

0

I had same problem, solution is just create a new SPFieldLookupValue and read LookupValue property. It's quite simple, but can save some time for others.

public String LinkTitleCode
{
    get
    {
        var lookupText = Get<String>("LinkTitleCode");
        return new SPFieldLookupValue(lookupText).LookupValue;
    }
}
-1

I had the same problem, got "ID# Lookup text" returned from workflow.

The workflow was set to return field as "String". I changed it to "Lookup Value (as text)" and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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