5

I am trying to trigger a translation job from an external workflow activity on a Web 8.5 instance. When I save the TranslationJobData I get the following error:

ERROR Project.Workflow.SendTranslationActivityWorker - System.ServiceModel.FaultException`1[Tridion.TranslationManager.V2.Data.TmServiceFault]: Nullable object must have a value. (Fault Detail is equal to Tridion.TranslationManager.V2.Data.TmServiceFault)

I am pushing the job using the following code:

public static string Translate(string userId, string title, string publicationId, IEnumerable<string> items, bool includeItemsAlreadyTranslated)
{
    using (SessionAwareTmServiceClient tmClient = new SessionAwareTmServiceClient("TmBinaryEndpointV2"))
    {

        TranslationJobData job = tmClient.CreateJob(title, publicationId, Tridion.TranslationManager.V2.Data.TranslationJobType.PushJob);

        job.RequiredDate = DateTime.Now;
         job.Priority = Tridion.TranslationManager.V2.Data.TranslationJobPriority.High;

        foreach (string item in items)
        {
            job.AddedItems.Add(new AddedItemData() { TcmUri = item });
        }
        job.IncludeItemsAlreadyTranslated = includeItemsAlreadyTranslated;
        job.State = Tridion.TranslationManager.V2.Data.TranslationJobState.ReadyForTranslation;

        tmClient.SaveJob(job);

        return job.Id.ToString();
     }
 }

Project.Workflow.SendTranslationActivityWorker calls Translate directly, and thus throws the error.

I've confirmed that the error does occur on the tmClient.SaveJob(job); I've also confirmed that none of the values I am adding to the job are null and that none of the values I am using to create the job are null. I've confirmed that I am using the correct endpoint on my tmClient. I can manually translate items with the same configuration as the items I am trying to translate through workflow, in the same publication.

  • You should look in log of TM on server when it is happening. Stacktrace will show where it fails. – Yuri Bondarchuk Jul 22 '18 at 16:21
  • 1
    But now when I thinking about this. You also need to specify ResolveInfo when you create AddedItem. Like this new AddedItemData() { TcmUri = item; ResolveInfo = ResolveInfo.TranslateParentItems | ResolveInfo.TranslateSubItems } – Yuri Bondarchuk Jul 22 '18 at 16:46
1

You also need to specify ResolveInfo when you create AddedItem.

job.AddedItems.Add(new AddedItemData() {
                                          TcmUri = item,
                                          ResolveInfo = ResolveInfo.TranslateParentItems | ResolveInfo.TranslateSubItems
                                       });

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.