Webpart error after initiated
I have created a costume workflow. When I Start a New Workflow it says "Error Occurred". In the history it says Workflow Initiated using "administrator"account (Logged in user) but below it there is ERROR and user id there is (System
Account).
I am not getting what is causing this error. Please help
Here is the code
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Xml.Serialization;
using System.Xml;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WorkflowActions;
namespace MyWF
{
public sealed partial class Workflow1 : SharePointSequentialWorkflowActivity
{
public Workflow1()
{
InitializeComponent();
}
public String HistoryDescription;
public String HistoryOutcome;
public Guid workflowId = default(System.Guid);
public Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties workflowProperties = new Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties();
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
workflowId = this.workflowProperties.WorkflowId;
}
private void logToHistoryListActivity1_MethodInvoking(object sender, EventArgs e)
{
// Generate message using information of current item
SPListItem item = workflowProperties.Item;
// determine whether workflow is running on a standard item or a document
if (item.File == null)
{
HistoryDescription = "Workflow started on item " + item.Title;
}
else
{
HistoryDescription = "Workflow started on document " + item.File.Name;
}
HistoryOutcome = "Workflow activation complete";
}
}
}
Thank you
February 28th, 2011 5:15am