Hi!
Did someone ever manage to use QueryDslAccessor properly?
I have a custom REST endpoint with scriptrunner in Jira to import issues from another system.
A step I'm missing is to alter the updated date which can not be done with the IssueManager or any other obvious methods I'm aware of.
I read about QueryDslAccessor but it does not seem to update anything.
In this example I try to alter the summary. The real use-case is to alter the updated date. But even this is not working:
import com.atlassian.jira.database.QueryDslAccessor
import com.atlassian.jira.model.querydsl.QIssue
import com.atlassian.jira.component.ComponentAccessor
def issue = ComponentAccessor.IssueManager.getIssueObject("DET-12")
QueryDslAccessor queryDslAccessor = ComponentAccessor.getComponent(QueryDslAccessor.class);
QIssue qissue = QIssue.ISSUE
queryDslAccessor.execute(dbConnection -> {
dbConnection.update(QIssue.ISSUE)
.set(QIssue.ISSUE.summary, "Hello World")
.where(QIssue.ISSUE.key.eq(issue.key))
.execute();
});
Hi @Charlie Misonne,
Have you tried using ScriptRunner's HAPI feature?
With HAPI, there are simpler ways to update the issue. For example:-
def issue = Issues.getByKey('ABC-1')
issue.update {
setSummary('an updated summary')
setDescription('hello *world*')
}
For more information on updating issues with HAPI, please refer to this ScriptRunner Documentation.
I am looking forward to your feedback.
Thank you and Kind regards,
Ram
Hi Ram,
Thanks for your answer. Yes I used HAPI in the past.
But can I updated the updated date of an issue with HAPI? I don't think so but if I'm overlooking it please let me know.
As mentioned in my question it is the updated field I need to adapt. In my example I only used summary to simplify the case to make sure I did not run into any date formatting issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.