I have developed custom multilevel approval workflow. For the same i have taken following steps:
Project created:
1) ApprovalWorkflowFeature (Its contain content type fields _AprrovalStatus and _ApprovalNotes).
2)CustomApprovalForms (ApprovalForm.aspx)
3) Multilevel Approval Workflow (Business Logic).
Workflow get start when new item created into specific sharepoint
library and it's show me In Process status. When i click on that it show
me Task to do, click on assigned task title and its open
ApprovalForm.aspx. When i press Approve button it invoke below method of
CustomApprovalForms (ApprovalForm.aspx).
protected void btnApprove_Click(object sender, EventArgs e)
{
Hashtable taskHash = new Hashtable(); // Task data is sent via a Hash Table
taskHash["_ApprovalNotes"] = txtApprovalNotes.Text;
taskHash["_ApprovalStatus"] = true;
SPWorkflowTask.AlterTask(this._TaskListItem, taskHash, true); //
Send the data to the task list, by altering the tasks value
SPUtility.Redirect(this._TaskListAttachedTo.DefaultViewUrl, //
Redirect the UI back to the Task List. You could chose
SPRedirectFlags.UseSource,
HttpContext.Current);
}
and get aprroval status into Multilevel workflow by:
private void onApprovalTaskChanged_Invoked(object sender, ExternalDataEventArgs e)
{
// Get the Approval Status (Approved or Declined) from the Workflow Form
this._primaryApprovalStatus
=
System.Convert.ToBoolean(onApprovalTaskChanged_AfterProperties1.ExtendedProperties["_ApporvalStatus"]);
// Since the Approver notes field is a Text Field, we will need to get the value of the field
// a bit differently. We need to get the ID of the field first and then we can use the ID (GUID)
// to get the fields value. Some fields are stored in the Extended List by name and some by ID,
// the safest way to get values is by using the ID, as I am showing you in ths step.
Guid notesFieldID = workflowProperties.TaskList.Items[0].Fields["Approval Form Notes Field"].Id;
// Check to see if the workflow is approved or not
if (onApprovalTaskChanged_AfterProperties1.ExtendedProperties[notesFieldID] != null)
{
// Get the notes from the Approval Form
_ApproverNotes = onApprovalTaskChanged_AfterProperties1.ExtendedProperties[notesFieldID].ToString();
}
// Set the Approval Task as completed
this._primaryApprovalTaskCompleted = true;
}
But each time i got
this._primaryApprovalStatus = false. i have debug workflow and i checked value of onApprovalTaskChanged_AfterProperties1.ExtendedProperties
it gives me value but not convert into bool type. Please suggest what i
am doing wrong.