Uploaded image for project: 'Elements Connect'
  1. Elements Connect
  2. CO-3737

Connect fields value is not retrieved in the "Email issue" JMWE post-function.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Do
    • Affects Version/s: 6.4.0
    • Fix Version/s: None
    • Labels:
    • Functional components:
      3rd party

      Description

      Steps to reproduce

      • Create a dummy Elements Connect field, as follows :
        • Select the native datasource "Jira database SQL"
        • Write the following query:
          SELECT id,pname FROM PROJECT
          
        • Enter 0 as the key
        • Write the following template:
          {1}
          
      • Add this field to the creation screen of a project
      • Edit the workflow of this project
      • Edit the Create transition
      • Add a post-function, as follows :
        • Select the post-function called "Email issue (JMWE add-on)"
        • Enter any subject
        • In the Text Body part, use the method to get a customfield value and insert the ID of the previously created Connect field:
          issue.get("customfield_xxxxx")
          
        • Select the reporter as the Recipient (be sure your email address is linked to your Jira account)
        • Move the post-function at the end of the post-functions list (after "Fire a Issue Created")
      • Create an issue from the related project and enter a value in the Connect field
      • Check the content of the email received

      Current Result
      The Connect field key (formated in JSON) is retrieved and displayed in the email

      Expected Result
      The display value of the Connect field should be retrieved instead of the key

      Workaround
      Use a groovy script in the JMWE post-function. Add this script in the "Html body" part

      Here is an example (some adaptations will have to be made according to your configuration):

      <% 
      import com.atlassian.jira.component.ComponentAccessor
       
      def pluginAccessor = ComponentAccessor.getPluginAccessor();
      def plugin = pluginAccessor.getPlugin("com.valiantys.jira.plugins.SQLFeed");
      def serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldDisplayService");
       
      def fieldDisplayService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);
       
      def customFieldId = "customfield_xxxxx";
       
      String displayValue = "";
      Object displayResult = fieldDisplayService.getDisplayResult(issue.get("issuekey"), customFieldId);
      if (displayResult != null) {
      	displayValue = displayResult.getDisplay();
      }
      print displayValue;
      %>
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brice.gestas@valiantys.com Brice Gestas
              Reporter:
              simon.laffont@elements-apps.com Simon Laffont
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: