Versions Compared

Key

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

...

  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)

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.

  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

...

Evaluating the above Test Case within the Script Field Processor Test section dynamically shows that the 3 issue keys have been extracted  from the subject, and can be set as the "issueKey" to drive commenting behavior, assuming the target issue(s) are in a state that is valid for commenting!

...

...

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.

Commenting

commenting on issues is just a matter of setting the required "issueKey" attribute of a result map, for example:

...