AnsweredAssumed Answered

Wrong course title on announcements

Question asked by br36524 on Oct 5, 2016

When using a building block to create a number of course announcements just after each other the subject of the emails are all prefixed with the course title from the first course. Though all the announcements are created and added to the courses correctly a large portion of the email notifications have the wrong subject.

 

Does anyone know how to avoid this...?

 

The announcements are created in a public static method like this:

  Announcement announcement = new Announcement();

  announcement.setBody(new FormattedText(bodyHtmlText,FormattedText.Type.HTML));

  announcement.setCreatorUserId(userId);

  announcement.setType(Announcement.Type.COURSE);

  announcement.setTitle(title);

  announcement.setPushNotify(sendNow);

  announcement.setRestrictionStartDate( fromDate );

  announcement.setRestrictionEndDate( toDate );

  announcement.setCourseId(courseId);

 

  try {

  announcement.validate();

  AnnouncementManagerFactory.getInstance().saveAnnouncement(announcement,null);

  if (sendNow) {

  AnnouncementManagerFactory.getInstance().sendAnnouncementEmail(announcement, bodyHtmlText);

  }

  } catch (Exception e) {

  e.printStackTrace();

  }

Outcomes