5

Is it possible to send email notification (configured in Target Publication) when Translation Job state changes?

I have followed SDL Tridion 2013 Live content to configure email notification, but it only sends single e-mail when Translation job is created from Tridion, also as per Live content:

"When you configure Target Publications for translation, you can specify a comma-separated list of email addresses in the Send notification email to field. When a Translation Job is sent for translation, an email is sent to the addressees listed in the Target Publication configured to receive the translated content notifying them of the items sent for translation."

Thanks & Regards, Navneet

10

As you note, the documentation - and the functionality - is explicit to the actual sending of the translation to the configured translation service.

If you want to extend the existing functionality then you could look to use the Event System.

public void TranslationJobManagerInitiated(object sender, TranslationJobEventArgs e)
   {
      e.TranslationJob.StateChanged += OnStateChanged; 
   }

private void OnStateChanged(object sender, TranslationJobStateChangeEventArgs e)
   {
      TranslationJob job = (TranslationJob)sender;

      // catch the specific state changes
         // Definition  
         // Ready for Translation   
         // Sending for Translation 
         // Error sending   
         // In Translation  
         // Error retrieving    
         // Completed   
         // Canceled    
         // Deleting
         // See doc link below for more info
      if (job.State == TranslationJobState.Completed)
      {
         // do stuff - watch who and how many emails you fire here!!!
      }
   }

States are explained here

If you hook into the TranslationJobManagerInitiated and use the OnStateChanged - but be sure to read the post (here) from Lars also as he notes that the event will be triggered multiple times - and it's not possible to unsubscribe as neither TranslationJob nor the session implements IDisposable.

As Lars points out, you may need to keep a dictionary of the status - so you don't start firing several emails for the same state change.

  • Thanks Dylan! Yeah, I agree dictionary will help in eliminating sending duplicate mails for same status. – Navneet Jun 14 '16 at 14:23

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.