3

I'm making workflow on Tridion 2013 SP1, but when I start workflow, automatic activity fails.

I made a simple workflow that has only 2 activities. 1st one is a manual activity and 2nd one is an automatic activity. The automatic activity source code is following (it only outputs text to a file "WorkflowFailure.log").

 class Activity1 : ExternalActivity
    {
        protected override void Execute()
        {
            outputlog("Activity1 start:" + ProcessInstance.Title);
            System.Threading.Thread.Sleep(5000); 
            CoreServiceClient.FinishActivity(ActivityInstance.Id, new ActivityFinishData { Message = "Finished" }, null);                          
        }
        public static void outputlog(string msg)
        {
            StreamWriter sw = new StreamWriter("C:\\tridion\\log-custom\\WorkflowFailure.log", true, System.Text.Encoding.UTF8);
            sw.WriteLine(DateTime.Now.ToString("yyyyMMdd hh:mm:ss:fff") + ":" + msg);
            sw.Close();
        }
    }

This automatic activity often fails, but it has very weired symptom.

  1. When I start same workflow again and again, sometimes it succeeds and sometimes it fails.
  2. When it fails, no log is output to Windows eventlog, and any Tridion log file.
  3. When it fails, no text is output to "WorkflowFailure.log" (This file is made by above automatic activity).

Because of 3rd symptom, I guess automatic activity itself is not called.

Does anyone know same issue?

What is problem?

5
  • How do you know that activity failed? Does it get into suspended state? If it gets into suspended state there should be an event log message. Also, I see you are using StreamWriter, which is blocking file while it's in use. Can it be the case that other activities are trying to write to it at the same time? Commented Jul 24, 2014 at 6:45
  • I know the activity failed by "Active Processes" of "Workflow Management" on TCME. There is red "X" icon on failed activity name in History of Activities panel.Also, same symptom occurs on activity that isn't use Streamwriter. Commented Jul 24, 2014 at 7:42
  • 1
    You should go to workflow administration and check on your activity. There will be reason for failure. You can also read ActivityInstance.SuspendOrFailReason Property through API Commented Jul 24, 2014 at 8:18
  • I checked "All activities" in workflow administration, and I found StreamWriter caused exception.It seems it's just StreamWriter problem.Thank you for advice.But I wonder why eventlog is not output at that time. Commented Jul 29, 2014 at 4:15
  • BTW...it is strange, that nothing is logged to event log in this case. Probably there is some invalid logging configuration of the WFAgent.
    – Syav4eg
    Commented Jul 29, 2014 at 8:33

1 Answer 1

1

So, just to post it as answer. In order to see what's going on with the automatic activity you need to check ActivityInstance.SuspendOrFailReason property through API, or go to Workflow administration node in CME and check it there.

1
  • Generally,when an error occurs in automatic activity,error message is logged to event log(if totally wrong file path is passed to StreamWriter in above source code,then error was logged to event log).But there seems to be special case that nothing is logged. Commented Jul 30, 2014 at 5:57

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.