I created State Machine Workflow regarding on Client Requirement Avery thing is working fine but Approver name not available in Assigned To in Task list field but Task is Created.

string Name_approver; ( This value Coming From SQL DB )

private void createTask1_MethodInvoking(object sender, EventArgs e) {

        createTask1_TaskId1 = Guid.NewGuid();
        createTask1_TaskProperties1.Title = workflowProperties.Item.Title;
        createTask1_TaskProperties1.AssignedTo = Name_approver;  **Here i hava a problem Please Help***
        //createTask1_TaskProperties1.ExtendedProperties["APPROVERNAME"] =  Name_approver;
        createTask1_TaskProperties1.ExtendedProperties["level"] = _IPFID;

        createTask1_TaskProperties1.ExtendedProperties["Invoice No"] = InvoiceNo;
        createTask1_TaskProperties1.ExtendedProperties["Invoice Date"] = InvoiceDate;
        createTask1_TaskProperties1.ExtendedProperties["Invoice Amount"] = InvoiceAmount;
        createTask1_TaskProperties1.ExtendedProperties["Invoice Duedate"] = InvoiceDuedate;
        ////createTask1_TaskProperties1.ExtendedProperties["Status"] = Status;

        createTask1_TaskProperties1.ExtendedProperties["Vendor Name"] = vendorname;
        createTask1_TaskProperties1.ExtendedProperties["Invoice_ServiceDate"] = InvoiceServiceDate;


1 Answer 1


Are you connected to the SQL DB in your WF solution and referencing that database?

You should be able to query the database and return your result (which will be a username) and pass that parameter to the string.

SqlConnection sqlConnection1 = new SqlConnection("Your Connection String");
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;

cmd.CommandText = "SELECT * FROM YourTable";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;


reader = cmd.ExecuteReader();
// Data is accessible through the DataReader object here.


Otherwise, for "Assigned To" you can just use "DOMAIN\username" to assign the appropriate task to a user or for a SharePoint group try:

createSPTask_TaskProperties1.AssignedTo = "SharePoint Group"

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.