Hi Team ,
This is the below scenario when i want to configure Scripted field .
Field Name -: Color Epic Field
Template -: Custom Template
Template-:
#if ($value > 5)
<h2> id=value1> $value </h2>
#else if( $value < 5)
<h2 id=value2> $value </h2>
#end
<style>
#value1
{ background-color: tomato;color: white; }
#value2
{ background-color: green;color: white; }
</style>
I#if ($value > 5)
<h2> id=value1> $value </h2>
#else if( $value < 5)
<h2 id=value2> $value </h2>
#end
<style>
#value1
{ background-color: tomato;color: white; }
#value2
{ background-color: green;color: white; }
</style>
Script to find no of epic in issues
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.bc.issue.search.SearchService.ParseResult;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.issue.search.SearchException;
import com.atlassian.jira.issue.search.SearchResults;
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.user.*
String key = issue.getKey()
final String jqlquery = "issueFunction in issuesInEpics('issuekey= $key')"
log.warn(jqlquery)
def Searchmanager = ComponentAccessor.getComponentOfType(SearchService) //call searchservice component
def CurrentUser = (ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()) as ApplicationUser
def parsequery = Searchmanager.parseQuery(CurrentUser, jqlquery) // method which returns of type Searchservice.parseresult
int count;
if(parsequery.isValid()) // use method isvalid to check the query validation
{ count = (Searchmanager.searchCount(CurrentUser,parsequery.getQuery())).toInteger() }
log.warn("${count.getClass()}")
return count
above code is correct , I believe custom template code is also correct but not giving expected results
But returning output1 (please check attachment) instead it should return output2(please check attachment )
here unnecessarily if statement is added , please resolve this issue .