Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm developing a custom workflow action for use in SharePoint Designer that will return a concatenated string from a list. It actually works fine internal to the action, but always returns an error.

I'm stumped to why it returns an error at the end. the function that is called here

public Hashtable ListColumnToString(SPUserCodeWorkflowContext context, string ListName, string ColumnName, string Delimiter)
{
    Hashtable results = new Hashtable();

    try
    {
        using (SPSite site = new SPSite(context.CurrentWebUrl))
        {
            using (SPWeb web = site.OpenWeb())
            {
                SPList list = web.Lists[new Guid(ListName)];
                string output = string.Empty;

                foreach (SPItem item in list.Items)
                {
                    output += item[ColumnName].ToString() + Delimiter;
                }

                results["OutputString"] = output;
                results["success"] = true;

                SPWorkflow.CreateHistoryEvent(web,
                    context.WorkflowInstanceId,
                    0,
                    web.CurrentUser,
                    TimeSpan.Zero,
                    "Information",
                    output,
                    string.Empty);
            }
        }
    }
    catch (Exception ex)
    {
        results["OutputString"] = string.Empty;
        results["success"] = false;
    }

    return results;
}

The workflow will correctly log the output value with what I expect, and at the point of the log command, the workflow action has completed the code block but the workflow still reports an error at this step.

enter image description here

I'm creating the workflow in SharePoint Designer 2010 and it only has one step and one has this custom action. If I add an additional action, it is never reached due to this error.

enter image description here

How do I get this to return success?

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.