Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With a given email being received, you want to be able to create or comment on multiple issues.

Step-by-step guide

  1. Create a JEMH TestCase, example below, update the 'To' address to match your Profile > Email > Catchemail address.  Update the Sender Email to be either valid for your system, or ensure your Profile > User > Default reporter user name is set.

    Code Block
    MIME-Version: 1.0
    Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
    Date: Sun, 19 Jun 2011 17:42:26 +1200
    Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
    Subject: This is a starting email template, update as required
    From: "Andy Brook" <andy@localhost>
    To: changeme@thiswontwork.com
    Content-Type: text/plain; charset=UTF-8
    
    some text


  2. Ensure that Profile > Directives > Directive Processing Behaviour is set to cover the scenario you want (e.g. On Create or Comment)

  3. Ensure that Profile > Field Processors : Script Field Processor is enabled

  4. From the Profile view, edit the Script Field Processor section at the bottom of the screen. On the Edit Script screen, paste the following script, updating values (project, issueType, priority) for your environment:

    Code Block
    //create a defaulat issue
    resultMap.put("labels", "hello-world");
    resultMap.put("FORCE_JEMH_SCRIPTFP", true);
    
    for (i =0 ; i<3 ; i++)
    {
    //print('adding result set #'+i);
    var newResultSet = jemhUtils.createResultSet();
    newResultSet.put("project", "TASK");
    newResultSet.put("issueType", "task");
    newResultSet.put("priority", "low");
    newResultSet.put("reporter", "admin");
    newResultSet.put("body", "do this.... \n"+ body);
    }
    
    var newResultSet = jemhUtils.createResultSet();
    newResultSet.put("issueKey", "DEF-7");
    
    print('extra result sets');
    var extra = jemhUtils.getResultSets().toArray();
    for (i =0 ; i<extra.length ; i++)
    {
        print('item #'+i+' project='+extra[i].get('project')+',issueType='+extra[i].get('issueType')+',priority='+extra[i].get('priority'));
    }
    
    print('done');


  5. At the bottom of Edit Script screen there is a edit-time Test feature, pick the Test Case you created above and hit Run.  You should see something as shown below, indicating multiple ResultSets and their values that will be used to drive issue creation (in this case)

  6. Image Modified
Info

The results only shown in the preview are values extracted from the script field processor. Values generated in the project mappings are not included. If null values are observed then it is possible that these haven’t been set yet and are set in the Project Mappings.

  1. If you now go to the Test Case screen, you can run the Test Case against the profile, the output should be the same

Need the 'user' of the Sender?

...

Filter by label (Content by label)
showSpacescript-field-processor
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@22b016
falsesortmodified
typeshowSpacepagefalse
reversetruelabels
typepage
cqllabel = "script-field-processor" and type = "page" and space = "JEMH"
labelsscript-field-processor


Page Properties
hiddentrue


Related issues