Hi to all,
I've been using Script Runner for a few months, and I found the built-in "Update on blocking issues" script quite useful. In our implementation, on a given transition of a Dev ticket, it comments on any linked Support issue.
Now, the linked issues I'd like to comment on are seen by our clients, and so is the automatic comment. I'd like to have the visibility level of the comment set on an internal group, but the option is not given by the built-in script.
Does anyone have the script of this post function, or know if it is available for me to improve? Is there any alternative script in which I could hope to find this feature?
Regards,
Mathieu
Hi Thanos,
Thanks for the quick answer and the link.
It is too bad I couldn't be given access to the built-in script, as it covered already 90% of what I need ... (I don't get very much why built-in scripts should be kept secret when one has the #1 selling script plug-in for JIRA).
Anyway, it obviously is a great plugin !
Regards,
Mathieu
PS : for whoever needs it, here's the script I got working, made from other scripts found around here as well. It's amazingly ugly and full of useless lines and imports, but it gets the job done for now ... feel free to edit a "clean" garbage-less one if needed !
import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.ComponentManager import com.atlassian.jira.component.ComponentAccessor def componentManager = ComponentManager.getInstance() def issueLinkManager = ComponentAccessor.getIssueLinkManager() import org.apache.log4j.Category import com.atlassian.jira.issue.comments.CommentManager import com.opensymphony.workflow.WorkflowContext import com.atlassian.jira.workflow.WorkflowTransitionUtil; import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl; import com.atlassian.jira.util.JiraUtils; def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction") log.setLevel(org.apache.log4j.Level.DEBUG) log.debug "debug statements" log.debug "Hello" String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller(); WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class ); def currentUserObj = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()// // Récupérer les informations de la requête client d'origine issueLinkManager.getInwardLinks(issue.getId())?.each {issueLink -> log.debug("Checking type : "+issueLink.issueLinkType.name) if (issueLink.issueLinkType.name == "0.Affilier") { log.debug ("Linktyp: " + issueLink.issueLinkType.name) log.debug ("Status parent: " + issueLink.sourceObject.getStatus()) log.debug ("ID parent: " + issueLink.sourceObject.getId()) log.debug ("Schlüssel Verlinkung: " + issueLink.sourceObject.getKey()) // Seulement si la requête client est à l'état Prise en Charge / Traitement Développeurs log.debug("Issue link destination of type "+issueLink.getSourceObject().getClass()) if ((issueLink.sourceObject.getStatus().getName() == "Prise en charge") || (issueLink.sourceObject.getStatus().getName() == "Traitement Développeurs") || (issueLink.sourceObject.getStatus().getName() == "Validé Club Utilisateurs")){ // Lancer la transition 71 vers Traitement Développeurs if (issueLink.getSourceObject() instanceof MutableIssue) { // Ajouter un commentaire CommentManager commentManager = (CommentManager) ComponentManager.getComponentInstanceOfType(CommentManager.class); String comment = "ATTENTION : une demande DEV affiliée à celle-ci a été fermée prématurément, pourquoi?"; commentManager.create(issueLink.getSourceObject(), currentUserObj, comment, null, (Long) 10001, true)////////// } } } else {log.debug("Hello CCCCCCCC")} }
nice one Mathieu...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathieu,
You can do this but in your own custom post function. And there you can use the commentManager to set group or/and project level restrictions in your comment. If you start writing the script I can assist you further.
I would also suggest you to create a feature request for the ability to set restrictions in comments in the built in script.
regards,
Thanos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!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.