I am new to ScriptRunner (Groovy) and was wondering if there was some simple guidance on how to access certain fields. I am used to programming in languages that are not object oriented so does anyone have a general list of "includes" libraries that might help me gain access to certain fields such as:
1. Access to simple system fields included out the box such summary, component, description,
2. Access for including custom fields that I create
3. The official time library used in conjunction with Groovy and Jira. ( I have tested out time earlier and it says the timestamp library is not supported)
The script that I am trying to write out is a "Post-function" script that checks if the summary name is "Test". If it is I want to update the description field with the the words "Test" and the summary with the words "New Summary". I have gone through some of the documentation and also browsed around for similar questions to mine but I am unsure of why exactly this is taking numerous lines of code to perform. Most examples include about 5 libraries as well as defining variables at the top. I thought Groovy was a dynamic-typed programming language so I am confused to why I'm seeing fields defined in most examples.
log.info("Running")
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.UpdateIssueRequest
String summary = issue.getSummary()
if (summary == "Test")
{
log.info("In")
}
Also, can someone please explain to me why when I do "log.info" NOTHING is returned in my logs??? I have even tried the example listed which is log.info("...") and nothing gets returned either.