"Undefined" when trying to use Soy template?

Hey together,

so I’m having some issues implementing my Soy template into my plugin.
The following is present:


    <web-resource key="library-management-resource-module" name="Wfenhance Library Management resource module">
        <transformation extension="soy">
            <transformer key="soyTransformer">
        <resource type="download" name="responsible-user-search.js" location="/js/responsible-user-search.js"/>
        <resource type="download" name="respusersearch-soy.js" location="/templates/respusersearch.soy"/>


{namespace JIRA.Templates.wfenhance}

{template .userSearch}
<form class="aui" id="kdp-user-select-form">

    <div class="field-group">
        <label for="kdp-user-select">Users</label>
        <div id="kdp-user-select"
                 placeholder="start typing a username ...">
        <div class="description">The users that should have kitchen duty.</div>
    <div class="buttons-container">
        <div class="buttons">
            <input class="button submit" type="submit"


success.vm (view where the template should appear)

    <meta name="decorator" content="atl.admin">
<body>`Preformatted text`

<div id="kdp-user-select-form"></div>

<p>Here you can manage your present library definitions and import or export them.</p>

The js file (responsible-user-search.js)

 * Created by schol on 7/4/2017.
var initUserSearch = function() {

   /* The following line is fine, I can see it has objects. However, my own is missing. */
    var test1 = JIRA.Templates;

    /* Consequently, the following line returns the described error */
    var templateUserSearch = JIRA.Templates.wfenhance.userSearch();


    require(['aui/flag'], function(flag) {
        var myFlag = flag({
            type: 'success',
            title: 'JIRA Wfenhance Responsible user search',
            body: 'JIRA Wfenhance Responsible user search controller is working'


Someone has an idea where something could be wrong?
I can see that the template doesn’t get found in the Dev Console.
I noticed my namespace seemingly can’t be found.
I don’t think it’s related to my resource as other code from the JavaScript file works (the flag shows up).

Greetings Marcus

Hi Marcus,

Maybe something stupid but can you try removing the leading / in your location path?
Like in the example: https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/web-resource-plugin-module

Unfortunately no, that doesn’t help.
Something I noted tough:
When looking at the script in the dev console something like this should be given at the start:

;/* module-key = 'com.comsysto.kitchen-duty-plugin:kitchen-duty-plugin-resources--planning-page', location = 'templates-soy/kitchen-duty-planning.soy' */
// This file was automatically generated from kitchen-duty-planning.soy.
// Please don't edit this file by hand.

 * @fileoverview Templates in namespace JIRA.Templates.KDP.

The example above is from a working version according to that tutorial here: https://comsysto.github.io/kitchen-duty-plugin-for-atlassian-jira/tutorial/06-step-03-planning-page--user-search-js-controller/

However, the view I’m having just starts like this:

;/* module-key = 'com.scholledev.jira-wfenhance:library-management-resource-module', location = 'js/responsible-user-search.js' */
var showSuccessFlag = function(a) {
    require(["aui/flag"], function(c) {
        var b = c({

Hi @schollemarcus,

It seems you’re missing SoyDoc in your template. I tested it out using your .soy file and was able to hit an error, although I didn’t get “Undefined”. Kindly add SoyDoc like

* This is user search and a sample SoyDoc
{template .userSearch}

Once I added this in the soy template you provided, it works already.

1 Like

Thanks for your comment and actually you’re right. I was able to sort this out. However there’s one more thing to mention - that got me undefined errors in the end: No blank spaces at the start of the Javadoc lines.

Greetings Marcus

Hi @iragudo,

Thank you so much, man!
It works for me as well, saved my life!

My question is, Why does that soy templates needs “Soy-docs” to work?

Thank you again anyway!


You’re welcome, @rafael.moreira. Soy templates or Google Closure templates requires a preceding Javadoc looking SoyDoc comments prior to a template. As to exactly why, I’m not 100% sure where it is being used under the hood, but it’s required as documented AFAIK.