sartography / cr-connect

0 stars 0 forks source link

Script hanging off Timer Event executing, but not updating Task Data #511

Closed calexh-sar closed 2 years ago

calexh-sar commented 2 years ago

In the IDS Approval workflow, the Send Reminder Email Script Task connected to the Timer Event hanging off of the Send Approver Response User Task contains this code:

if which_email == "ids_init":
    which_email_subject = "An Initial IDS Submission email was sent ot you on " + email_send_approval_request[0].date_sent
else:
    if num_denied_occ == 1:
        which_email_subject = "A First IDS Resubmission email was sent ot you on " + email_send_approval_request[1].date_sent
    elif num_denied_occ == 2:
        which_email_subject = "A Second IDS Resubmission email was sent ot you on " + email_send_approval_request[2].date_sent
    elif num_denied_occ == 3:
        which_email_subject = "A Third IDS Resubmission email was sent ot you on " + email_send_approval_request[3].date_sent
    elif num_denied_occ == 4:
        which_email_subject = "A Fourth IDS Resubmission email was sent ot you on " + email_send_approval_request[4].date_sent
    else:
        which_email_subject = "A Fifth or more IDS Resubmission email was sent ot you on " + email_send_approval_request[5].date_sent

## Email Subject
email_subject_all = email_subject_opt1 + which_email_subject + COVIDmessage

email_data = email(subject=email_subject_all, recipients=email_to, bcc=email_bcc)

# Get email data and add local date and time sent
ids_email_sent_str = email_data["timestamp"]
ids_email_sent_dt = dateparser.parse(ids_email_sent_str)
ids_email_sent_date = ids_email_sent_dt.strftime("%m-%d-%Y")
ids_email_sent_time = ids_email_sent_dt.strftime("%I:%M %p")

# Add local timezone, date and time to email data dict
email_data['timezone'] = 'US/Eastern'
email_data["date_sent"] = ids_email_sent_date
email_data["time_sent"] = ids_email_sent_time

#Add email to list
email_send_approval_reminder.append(email_data)

The code seems to execute properly since the correct email is sent if the Timer Event triggers, by the Task Data is not updated to reflect that it does. Specifically, the line email_send_approval_reminder.append(email_data) does not update the email_send_approval_reminder list.

calexh-sar commented 2 years ago

Discussed this with @danfunk post scrum and he explained that the task data was not getting recorded because this task was not in the main flow of the workflow. He is going to write a ticket for a logging service that can be used to capture this and other events (both BPMN Events and non-BPMN events) that will later be used for metrics.