[
https://issues.apache.org/jira/browse/VELOCITY-854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergiu Dumitriu closed VELOCITY-854.
------------------------------------
Resolution: Invalid
Assignee: Sergiu Dumitriu
> Problem Creating a Default description
> --------------------------------------
>
> Key: VELOCITY-854
> URL: https://issues.apache.org/jira/browse/VELOCITY-854
> Project: Velocity
> Issue Type: Bug
> Components: Build
> Reporter: Brian
> Assignee: Sergiu Dumitriu
> Priority: Minor
>
> Hi Experts
> I have an issue with creating a default description based on Issue Type and
> Based on what Option is selected from the Custom Field. (Single Select List)
> Not sure whether I am working on this correctly but I will explain what I
> expecting first.
> For Issue Type: Service Request I have a Custom Field Called Request Type (3
> Options are available) For each of these 3 options when one is selected I
> would like a different Description to display. Currently it doesn't actually
> change the description based on Custom Field
> This is my code what I have placed in
> /opt/jira/atlassian-jira/WEB-INF/classes/templates/jira/issue/field/description_edit.vm
> {noformat}
> #disable_html_escaping()
> #customControlHeader ($action $field.id $i18n.getText($field.nameKey)
> $fieldLayoutItem.required $displayParameters $auiparams)
> ## setup some additional parameters
> $!rendererParams.put("class", "long-field")
> $!rendererParams.put("rows", "12")
> $!rendererParams.put("wrap", "virtual")
> #if ($mentionable)
> $!rendererParams.put("mentionable", true)
> #if ($issue.project.key && $issue.project.key != "")
> $!rendererParams.put("data-projectkey", "$!issue.project.key")
> #end
> #if ($issue.key && $issue.key != "")
> $!rendererParams.put("data-issuekey", "$!issue.key")
> #end
> #end
> ##===============================
> START CUSTOMIZATION
> ## SET INCIDENT
> #if (($issue.key == $null) && ($issue.getIssueTypeObject().getName() ==
> "Incident"))
> #set ($description = 'h6. Steps to Reproduce
> # Navigate to ...
> # Click on ...
> \
> h6. Expected Results
> \
> h6. Actual Results
> \
> h6. Other Information (Browser, Browser Version,
> Environment)')
> #set ($description = $description.replace('\',''))
> ## SET SERVICE REQUEST 'NONE'
> #elseif ((($issue.key == $null) && ($issue.getIssueTypeObject().getName() ==
> "Service Request"))
>
> *($ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByValue("customfield_11504")));
> #if ($getcustomfieldObjectByValue ==
> "customfield_11504").getOptionbyName == "Enhancement")
> #set ($description = 'Please select a Request Type')
> #set ($description = $description.replace('\',''))
> ## SET SERVICE REQUEST 'DEPLOYMENT'
> #elseif ($getcustomfieldObjectByValue ==
> "customfield_11504").getOptionbyName == "Deployment")
> #set ($description = 'h6. Name of System -
> \
> h6. Environment -
> \
> h6. Expected Delivery Date / Time -')
> #set ($description = $description.replace('\',''))
> ## SET SERVICE REQUEST 'NEW ACCOUNT'
> #elseif ($getcustomfieldObjectByValue ==
> "customfield_11504").getOptionbyName == "New Account")
> #set ($description = 'h6. Are you requesting for a new
> account to be set up?
> \
> h6. Name of System -
> \
> h6. Name of New User -
> \
> h6. Contact Information (Email Address, Contact Number) -')
> #set ($description = $description.replace('\',''))
> #end
> ## SET CHANGE REQUEST
> #if (($issue.key == $null) && ($issue.getIssueTypeObject().getName() ==
> "Change Request"))
> #set ($description = 'h6. Change Logs
> \
> h6. Deployment Script
> \
> h6. Deployment Verification
> \
> h6. Roll Back Plan')
> #set ($description = $description.replace('\',''))
> #end
> ## END CUSTOMIZATION
> ## =======================================
> ## let the renderer display the edit component
> $rendererDescriptor.getEditVM($!description, $!issue.key,
> $!fieldLayoutItem.rendererType, $!field.id, $field.name, $rendererParams,
> false)
> #customControlFooter ($action $field.id
> $fieldLayoutItem.getFieldDescription() $displayParameters $auiparams)
> {noformat}
> I receive this error
> {noformat}
> An error occurred whilst rendering this message. Please contact the
> administrators, and inform them of this bug. Details: -------
> org.apache.velocity.exception.ParseErrorException: Encountered "<EOF>" at
> templates/jira/issue/field/description-edit.vm[line 80, column 110] Was
> expecting one of: "(" ... <RPAREN> ... <ESCAPE_DIRECTIVE> ... <SET_DIRECTIVE>
> ... "##" ... "\\\\" ... "\\" ... <TEXT> ... "*#" ... "*#" ...
> <STRING_LITERAL> ... <END> ... <IF_DIRECTIVE> ... <ELSEIF_DIRECTIVE> ...
> <ELSE_DIRECTIVE> ... <STOP_DIRECTIVE> ... <INTEGER_LITERAL> ...
> <FLOATING_POINT_LITERAL> ... <WORD> ... <BRACKETED_WORD> ... <IDENTIFIER> ...
> <DOT> ... "{" ... "}" ... at
> org.apache.velocity.Template.process(Template.java:141) at
> {noformat}
> For incident and Change request these actually do change the description and
> these will not need to be changed or modified in anyway
> Any help would be appreciated as I am unsure whether this will work
> regardless of the error.
> Regards
> Brian
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]