Uploaded image for project: 'Xporter for Jira Cloud'
  1. Xporter for Jira Cloud
  2. XPORTERCLOUD-2309

Javascript functions stopped working

    XporterXMLWordPrintable

Details

    Description

      Description
      Javascript .search and .replace stopped working with Xporter.

      Example for .search Javascript
      How to reproduce

      1. Create a new issue and add a value ´test´ to a label field, for example, the Components field.
      2. Create a template with the following code that uses the .search Javascript filter.
        Here´s an example:
        &{for issues|filter=%{'${IssueTypeName}'.equals('Story') && ‘${Components}’.search(‘test’)>=0}}
        ${Key}
        &{end}
        
      3. Export the template from the Issue Navigator

      Actual result/Attachments
      It should export the Story Issues that contain the ´test´ component and replacing the

      Expected result
      It doesn´t export any value.

      Workaround
      Use the .contains Javascript workarounds this issue:
      Here´s the code with the workaround:

      &{for issues|filter=%{'${IssueTypeName}'.equals('Story') && ‘${Components}’.contains(‘test’)}}
      ${Key}
      &{end}
      

      Example for .replace Javascript
      How to reproduce

      1. Create a new issue and add a value ´12345678´ to a field, for example, the Description field.
      2. Create a template with the following code that uses the .replace Javascript.
        Here´s an example:
        %{var sum = Number(${Description}); var rounded = sum.toFixed(2); var currency = "$" + rounded.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); currency}
        ${sum}
        
      3. Export the template from the Issue Navigator

      Actual result/Attachments
      It should apply the Javascript and export it.

      Expected result
      It doesn´t export any value.

      Workaround
      Removing the replace from the Javascript and use another kind of Javascript like for example the .indexOf is working.

      Version

      • 2.1.1

      Attachments

        Activity

          People

            roy.mehmood Roy Mehmood
            mrap Mario Peixoto
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: