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:

someone@email.com;#23 -> everything works fine though, the recipient gets the email

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

someone@email.com;#23;someone2@email.com;#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.

  • 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? – spevilgenius Oct 3 '14 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. – escape_artist Oct 3 '14 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? – Ruslan Dayanov Oct 3 '14 at 10:21
  • I'm adding the value by "Workflow Lookup for a User". – escape_artist Oct 3 '14 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: 'someone1@email.com;someone2@email.com;#45;someone3@email.com;someone4@email.com;#46' – escape_artist Oct 3 '14 at 11:05
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, privacy policy and cookie policy

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