Hello,
I have a custom "Field A" that needs to be populated with the date/time when another custom "Field B" was set to "Yes".
I need to create a script that:
Any ideas?
Fabio,
I think there's no direct way, you need to query the rest api for the changelog of every issue, check the modifications and derive the date from this information.
then you can add the date to another field for querying
Thanks Gaston,
In this case you would do everything with REST API, get the information and update the tickets? Or you would get the information with REST API and update the fields with ScriptRunner?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it depends on your needs, for example if I need to record the first date that the field changed:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you need to get the date value right away I'll do the same but with a listener and only the current issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is what I have so far:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class)
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def query = jqlQueryParser.parseQuery("myJQL")
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())
results.getIssues().each {
//code to get date/time when "Field B" was set to "Yes"
//code to add the date/time to "Field A"
}
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.