Uploaded image for project: 'Jira Service Management Cloud'
  1. Jira Service Management Cloud
  2. JSDCLOUD-4549

CustomerRequest.CustomerRequestStatus.status() returns null on certain condition

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Service Desk Cloud. Using JIRA Service Desk Server? See the corresponding bug report.

      Summary

      There is a Bug in the code. The CustomerRequest.currentStatus().status() SD API randomly returns a null value if the following conditions are met

      • Destination status has to have same 'Status name to show customer' as other statuses in the workflow/project
      • Issue has to be transitioned to such status using automation

      The null does not seem like something random, as it would happen on a resolution change that did not also include a status change (or status name shown to customer change).

      private List<CustomerRequestStatus> getRequestStatusSortedByDate(ApplicationUser user,
                                                                           Issue issue,
                                                                           RequestType requestType) {
              RequestStatusMapper mapper = requestStatusService.getStatusMapper(requestType);
              List<ActivityItem> statusChangeActivities = statusAndResolutionActivityProvider.getActivityStream(user, issue);
              //if statusChangeActivities is empty, then return current status
              if (statusChangeActivities.isEmpty()) {
                  return newArrayList(new CustomerRequestStatusImpl(mapper.translateToCustomerStatus(issue.getStatus()), issue.getCreated().toInstant()));
              } else {
                  // TODO: this is actually wrong. We are fetching all change items, which will not give us the original status at issue creation time!
                  return FpKit.map(statusChangeActivities, s -> {
                      if (s instanceof StatusUpdateActivityItem) {
                          return new CustomerRequestStatusImpl(((StatusUpdateActivityItem) s).getNewStatusName(), s.getActivityInstant());
                      } else { // else if (s instanceof ResolutionUpdateActivityItem) {
                          // TODO: should skip updates that don't have a status. This code was broken before hence we keep as-is
                          return new CustomerRequestStatusImpl(((ResolutionUpdateActivityItem) s).getStatusName().getOrNull(), s.getActivityInstant());
                      }
                  });
              }
          }
      

      This should actually skip the resolution change if there is no status.

      Attachments

        Issue Links

          Activity

            People

              mmcmahon Matthew McMahon (Inactive)
              ywoo Yit Wei
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: