1

I am implementing translation manger from the automatic activity in the workflow and getting the below error while executing the automatic activity.

State: Failed State Message: Tridion.ContentManager.Workflow.WorkflowEngineException: Activity instance '3. Translation' (tcm:X-XXX-XXXXXX) must be in 'Finished' state after script execution by Workflow Agent, but actual state is 'Started'. at Tridion.ContentManager.Workflow.WorkflowAgentEngine.ProcessActivity(TcmUri activityInstanceId, Boolean isExpirationExecution).

Note - I am using Tridion 2013 SP1 API with web 8 which works with 2013 version. Here is my code

 var result = ExecuteWorker(new SendTranslationActivityWorker(), CoreServiceClient, ActivityInstance.WorkItems.Select(workItem => workItem.Subject.IdRef).ToList());
            if (result.Success)
            {
                if (result.SuspendActivity)
                {
                    var suspendedActivity = CoreServiceClient.SuspendActivity(ActivityInstance.Id, Definitions.WAIT_FOR_TRANSLATION_REASON, null, Definitions.WAIT_FOR_TRANSLATION_BOOKMARK, NewReadOptions);
                    if (result.Variables != null)
                    {
                        foreach (var variable in result.Variables)
                        {
                            ProcessInstance.Variables.Add(variable.Key, variable.Value);
                        }
                    }
                }
                else
                {
                    CoreServiceClient.FinishActivity(ActivityInstance.Id, GetResumeFinshData(Definitions.NOT_SUSPENDED_MESSAGE), null);
                }
            }
            else {
                CoreServiceClient.FinishActivity(this.ActivityInstance.Id, GetTranslationErrorFinshData(result.Message), null);
            }



private ActivityFinishData GetTranslationErrorFinshData(string message)
        {
            ActivityFinishData finishData = new DecisionActivityFinishData()
            {
                Message = message,
                NextActivity = GetNextActivityByTitle(Utility.GetAppSetting(Definitions.RESUME_TRANSLATION_ERROR_NEXT_ACTIVITY))
            };
            return finishData;
        }
  • 1
    There's a lot of configuration in there. Can you confirm that Utility.GetAppSetting(Definitions.RESUME_TRANSLATION_ERROR_NEXT_ACTIVITY) returns the correct name for the activity you wish to - and that all Definitions are being read with values you expect? – Dylan .. Mark Saunders May 25 '16 at 20:39
2

On the automatic activity, you don't need to add the NextActivity to the finishData.

If you change your method to:

private ActivityFinishData GetTranslationErrorFinshData(string message) { ActivityFinishData finishData = new ActivityFinishData() { Message = message }; return finishData; }

Then I'd suggest that the above will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.