Canned Response issue operation plugin

The Issue Operations Plugin Module is very easy to use, because for simple links you don't even need to write any code. Here is how to create a sample 'Canned Response' link on issues, which populates the comment field with a canned response via Javascript:

Unknown macro: {version-warn}

JIRA 3.4 and higher

jturner@teacup:/tmp$ deploy 3.4.1 ent
   Deploying new JIRA 3.4.1 enterprise distribution 
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.1-standalone$ cd external-source/
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.1-standalone/external-source$ mkdir etc
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.1-standalone/external-source$ cat > etc/atlassian-plugin.xml
<atlassian-plugin key="com.atlassian.sample.cannedresponse" name="Canned Response plugin">
    <plugin-info>
        <description>Adds a button with a canned response to populate a comment</description>
        <version>1.0</version>
        <application-version min="3.4" max="3.4"/>
        <vendor name="Atlassian Software Systems Pty Ltd" url="http://www.atlassian.com"/>
    </plugin-info>

    <issue-operation key="canned-response" name="Canned Response" class="com.atlassian.jira.plugin.issueoperation.DefaultPluggableIssueOperation" state='enabled'>
        <resource type="velocity" name="view">
            &lt;img src="$req.contextPath/images/icons/bullet_creme.gif" height=8 width=8 border=0 align=absmiddle&gt;
            &lt;b&gt;&lt;a href="javascript:(function(){document.getElementById('comment').value='Thanks for your report.
 This bug has been earlier reported at XXXXX. Please add yourself as a watcher to that issue to be notified of updates.'})()"&gt;Canned Response&lt;/a&gt;&lt;/b&gt;
        </resource>
        <!-- the relative order of operations -->
        <order>10</order>
    </issue-operation>
</atlassian-plugin>
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.1-standalone/external-source$ ant
Buildfile: build.xml

prepare:
    [mkdir] Created dir: /tmp/atlassian-jira-enterprise-3.4.1-standalone/external-source/src
    [mkdir] Created dir: /tmp/atlassian-jira-enterprise-3.4.1-standalone/external-source/lib

compile:
     [copy] Copying 1 file to /tmp/atlassian-jira-enterprise-3.4.1-standalone/atlassian-jira/WEB-INF/classes

BUILD SUCCESSFUL
Total time: 1 second
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.1-standalone/external-source$ cd ../
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.1-standalone$ ./bin/startup.sh 
Using CATALINA_BASE:   /tmp/atlassian-jira-enterprise-3.4.1-standalone
Using CATALINA_HOME:   /tmp/atlassian-jira-enterprise-3.4.1-standalone
Using CATALINA_TMPDIR: /tmp/atlassian-jira-enterprise-3.4.1-standalone/temp
Using JRE_HOME:       /usr/java/j2sdk
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 09, 2005

    Mark Derricutt says:

    Out of interesting, what's the "deploy" process you're running in the above exam...

    Out of interesting, what's the "deploy" process you're running in the above example? Is it just a script, or some funky deployment agent?

  2. Dec 09, 2005

    Mark Derricutt says:

    s/interesting/interest/ ;)

    s/interesting/interest/

    1. Dec 11, 2005

      Brian Nguyen says:

      Hi Mark, The deploy process is just a script that finds, downloads and unzips th...

      Hi Mark,

      The deploy process is just a script that finds, downloads and unzips the Jira standalone distribution. We use this internally so it isn't readily available to our users.

      Thanks,
      Brian

  3. May 15, 2006

    Rene Verschoor says:

    I fail to see how this example can work. The Issue Operations plugin shows up in...

    I fail to see how this example can work.
    The Issue Operations plugin shows up in the Issue Details screen.
    It tries to change the value of the Comment field.
    However, the Comment field doesn't show up until you Edit the issue.

    1. May 16, 2006

      Justin Koke says:

      Hi Rene, If you view the source of the page, there is a hidden AddComment form....

      Hi Rene,

      If you view the source of the page, there is a hidden AddComment form. This form appears when you click the Comment link in the left hand nav.

      Regards,
      Justin