Hi,
I need to send email based on standard velocity template from Jira Scripting Suite post action during issue creation. I need to implement condition checker. I think I have everything necessary but getting very strange exception when generating HTML output.
Using Jira 6.1.5 with the latest Jira Scripting Suite.
I will appreciate any help.
JSS Code:
from com.atlassian.jira.component import ComponentAccessor from java.util import HashMap from java.lang import String from java.lang import Object from java.lang import System from com.atlassian.jira.config.properties import APKeys ap = ComponentAccessor.getApplicationProperties(); baseUrl = ap.getString(APKeys.JIRA_BASEURL); webworkEncoding = ap.getString(APKeys.JIRA_WEBWORK_ENCODING); vm = ComponentAccessor.getVelocityManager() vp = ComponentAccessor.getVelocityParamFactory() context = vp.getDefaultVelocityParams() context.put("issueObject", issue) context.put("baseurl", baseUrl) renderedText = vm.getEncodedBody("C:/atlassian-jira/WEB-INF/classes/templates/email/html/", "issuecreated.vm", baseUrl, webworkEncoding, context); log.info("-----") log.info(renderedText) log.info("-----")
Error:
/secure/QuickCreateIssue.jspa [jira.plugin.workflow.JythonPostFunction] An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(Unknown Source) at sun.misc.URLClassPath.findResource(Unknown Source)
Community moderators have prevented the ability to post new answers.
Try
renderedText = vm.getEncodedBody("templates/email/html/", "issuecreated.vm", baseUrl, webworkEncoding, context);
I think it is not very wise to use to absolute path to the resource!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.