How to find all workflows which are using postfunctions of a plugin

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 26, 2013

We need to upgrade a JIRA, but one of the plugins is not compatible.
How can we find all the workflows which are using the workflow functions from this plugin ?

9 answers

1 accepted

5 votes
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2013

You could use the Script Runner plugin to search for more detailed uses. I wrote a script to create a list which than can be used e.g. in Excel for further investigations.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.JiraWorkflow
import com.atlassian.jira.workflow.WorkflowManager
import java.util.regex.Matcher

String searchText = 'com.googlecode.jsu.workflow.'

WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager()
Collection<JiraWorkflow> workflows = workflowManager.getWorkflows()

String result = "Workflow;Function;Type;Action;Step\r\n"

workflows.each{workflow ->
    workflowXml = workflow.descriptor.asXML()
    Matcher m = workflowXml =~ /${searchText}/
    if (m.find()) {
        String workflow_name = "${workflow.name}${if(!workflow.isActive()){"(inactive)"} else ''}${if(workflow.isDraftWorkflow()){"(draft)"} else ''}"
        def wf = new XmlParser().parseText(workflowXml)
        List<Node> wf_flat = wf.depthFirst()
        wf_flat.each{
            if (it.text() ==~ /.*${searchText}.*/){
                result += "$workflow_name;${getNodeInfo(it,searchText)}\r\n"
            }
        }
    }
}
result

String getNodeInfo(Node n, String search) {
    String nodetext = ''
    nodetext += "${n.text() - search}"
    def p = n.parent()
    while (p) {
        switch (p.name()) {
            case 'post-functions':
                nodetext += ";post-function"; break
            case 'validators':
                nodetext += ";validator"; break
            case 'conditions':
                nodetext += ";condition"; break
            case 'action':
                nodetext += ";${p.attribute('name')} (${p.attribute('id')})"; break
            case 'step':
                nodetext += ";${p.attribute('name')} (${p.attribute('id')})"; break
            case 'global-actions':
                nodetext += ";GLOBAL"; break
            case 'initial-actions':
                nodetext += ";INITIAL"; break

        }
        p = p.parent()
    }
    return nodetext
}

You have to adapt the searchText to match the plugin.

Henning

 

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 26, 2013

That's a cool approach, not requiring to access JIRA 'behind the scenes'
Certainly a candidate for a build-in script (IMO)

Bryan Karsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2016

Henning - this a beautiful solution. Thanks for sharing!

Bryan Karsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2016

@Henning Tietgens  – quick question. in the getNodeInfo method – why are you using the minus operator here:

 nodetext += "${n.text() - search}"

 

It looks like it's removing the search term from nodetext...?  Not sure why you are doing that. Any tips / insight much appreciated!

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2016

You're right. It's only for shorter list entries.

Cyril Egan January 31, 2019

Hi @Henning Tietgens

This is brilliant!  I am planning a Jira upgrade with numerous plugins and numerous workflows.  Remembering what post-functions I used and where I used them is now infinitely easier for doing my testing.  Thank you!

Adam Kopleff September 1, 2022

@Henning Tietgens 

Seeing that this was last updated in 2018.  We are preparing to migrate to the Cloud finally and curious if this script is still applicable before I try it? 

Update:  I did run it and it worked.  I am not that familiar with scripting myself, is there any one that could help me get results back ignoring inactive workflows?  Our environment is a mess and we have tons of copies of workflows that sit inactive.

Thanks,

Adam

8 votes
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

Hi,

Another updated version, now building the search string from the modules used by the app identified by an app key. Reporting used custom fields, too.

package eventim.scripts

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.plugin.workflow.AbstractWorkflowModuleDescriptor
import com.atlassian.jira.workflow.JiraWorkflow
import com.atlassian.jira.workflow.WorkflowManager
import com.atlassian.plugin.PluginAccessor

import java.util.regex.Matcher

String appKey = "com.innovalog.jmcf.jira-misc-custom-fields"
String result = ""

PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor()
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager()
def p = pluginAccessor.getPlugin(appKey)
if (p) {
def modules = p.getModuleDescriptors()
def implementationClasses = modules.findAll{
it instanceof AbstractWorkflowModuleDescriptor
}.collect{
it as AbstractWorkflowModuleDescriptor
}*.implementationClass.name
def searchText = implementationClasses.join('|')
log.debug "searchText: $searchText"
Collection<JiraWorkflow> workflows = workflowManager.getWorkflows()

result = "Workflow;Function;Type;Action;Source-Step<br>"

workflows.each{workflow ->
def workflowXml = workflow.descriptor.asXML()
Matcher m = workflowXml =~ /${searchText}/
if (m.find()) {
String workflow_name = "${workflow.name}${workflow.isActive()?"":"(inactive)"}${workflow.isDraftWorkflow()?"(draft)":""}"
log.debug "Found: $workflow_name"
def wf = new XmlParser().parseText(workflowXml)
List<Node> wf_flat = wf.depthFirst()
wf_flat.each{ node ->
if (implementationClasses.contains(node.text())) {
log.debug "Found node $node"
def implementationClassName = implementationClasses.find{it == node.text()}
def nodeInfo = getNodeInfo(node, implementationClassName)
if (nodeInfo) {
result += "$workflow_name;$nodeInfo<br>"
}
}
}
}
}

result += "<br>Customfields<br>"

def customfieldmanager = ComponentAccessor.customFieldManager
result += customfieldmanager.customFieldObjects.findAll{
it.customFieldType.key ==~ appKey + /.*/ ||
it.customFieldSearcher?.descriptor?.toString() ==~ appKey + /.*/
}.collect{
"$it.name ($it.customFieldType.name, ${it.customFieldSearcher?.descriptor})"
}.join("<br>")

}
result

static String getNodeInfo(Node n, String implementationClassName) {
String nodetext = ''
def valid_action = false
def valid_function = false
def valid_step = false
n = n.parent()
if (n.name() in ['function','condition','validator']) {
nodetext += implementationClassName + ";"
def p = n.parent()
while (p) {
switch (p.name()) {
case 'post-functions':
valid_function = true
nodetext += "post-function;"; break
case 'validators':
valid_function = true
nodetext += "validator;"; break
case 'conditions':
valid_function = true
nodetext += "condition;"; break
case 'action':
valid_action = true
nodetext += "${p.attribute('name')} (${p.attribute('id')});"; break
case 'step':
valid_step = true
nodetext += "${p.attribute('name')} (${p.attribute('id')})"; break
case 'global-actions':
valid_step = true
nodetext += "GLOBAL"; break
case 'initial-actions':
valid_step = true
nodetext += "INITIAL"; break
}
p = p.parent()
}
}
if (valid_action && valid_function && valid_step) {
return nodetext
} else {
return ""
}
}

Have fun,
Henning

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

Hi @Henning Tietgens ,

Thank you for keeping an extra eye on this problem, but there is no workflow step returned, only custom fields

Workflow;Function;Type;Action;Source-Step

Customfields
Calculated Date-Time Field (JWT Migration) (Calculated Date-Time Field (by JWT), com.atlassian.jira.plugin.system.customfieldtypes:datetimerange (Allow searching for a date and time that is between two other dates and times))
Calculated Text Field (JWT Migration) (Calculated Text Field (by JWT), com.atlassian.jira.plugin.system.customfieldtypes:textsearcher (Search for values using a free text search.))

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

I updated the script again to look for the implementation class to find workflow functions. Please try again.

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Hi @Henning Tietgens ,

Good day! Sorry to disturb you but still it does not return the validators, only post functions, I have tried to download xml file and search for validators, I found com.innovalog.jmwe.plugins.validators.FieldRequiredValidator and use it on appKey. 

Still returning null as result. Have you tried to check validators also using the script? Thank you!

Best Regards,
Alvin

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Hi Alvin,

com.innovalog.jmwe.plugins.validators.FieldRequiredValidator is not the appKey. Please go to Manage Apps in Jira and click on the corresponding app (plugin). There you could see the app key. Maybe it's com.innovalog.jmwe but this is just a guess.

E.g. this is for Jira Toolkit Plugin

Capture 2019-06-18_10-28-49_AM.pngBest regards,
Henning

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Hi @Henning Tietgens ,

Thank you for that, I have used it before but it only returns post-functions, not the validators.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Could you please add

import org.apache.log4j.Level
log.setLevel(Level.DEBUG)

after the imports at the beginning of the script and tell me the log output and the validator part of the xml export of the workflow?

If you want to limit the output to your test workflow you could add

workflows.findAll{it.name == 'Testworkflow'}.each{workflow ->

to the corresponding line (replacing Testworkflow with the name of the workflow).

Henning 

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

2019-06-18 20:03:42,307 DEBUG [runner.ScriptRunnerImpl]: searchText: com.fca.jira.plugins.workflowToolbox.CascadeSelectComparatorCondition
|com.fca.jira.plugins.workflowToolbox.IfMatchesRegexpCondition|com.fca.jira.plugins.workflowToolbox.AllowedLinksCondition
|com.fca.jira.plugins.workflowToolbox.AnyIssueCondition|com.fca.jira.plugins.workflowToolbox.MathExpressionsCondition
|com.fca.jira.plugins.workflowToolbox.ParsedTextsCondition
|com.fca.jira.plugins.workflowToolbox.ExceptAssigneeCondition
|com.fca.jira.plugins.workflowToolbox.ExceptReporterCondition
|com.fca.jira.plugins.workflowToolbox.NotInProjectRoleCondition
|com.fca.jira.plugins.workflowToolbox.OnlyUserInCustomFieldCondition
|com.fca.jira.plugins.workflowToolbox.ExceptUserInCustomFieldCondition
|com.fca.jira.plugins.workflowToolbox.UserInFieldInRolCondition
|com.fca.jira.plugins.workflowToolbox.InitializedCondition|com.fca.jira.plugins.workflowToolbox.ProjectPropertyCondition
|com.fca.jira.plugins.workflowToolbox.AllowedSubtasksCondition
|com.fca.jira.plugins.workflowToolbox.JQLCondition|com.fca.jira.plugins.workflowToolbox.SoftwareTriggeredCondition
|com.fca.jira.plugins.workflowToolbox.BulkOperationCondition
|com.fca.jira.plugins.workflowToolbox.IfMatchesRegexpValidator
|com.fca.jira.plugins.workflowToolbox.AllowedLinksValidator|com.fca.jira.plugins.workflowToolbox.AnyIssueValidator|com.fca.jira.plugins.workflowToolbox.MathExpressionsValidator|com.fca.jira.plugins.workflowToolbox.ParsedTextsValidator|com.fca.jira.plugins.workflowToolbox.UserInFieldInRolValidator|com.fca.jira.plugins.workflowToolbox.InitializedValidator|com.fca.jira.plugins.workflowToolbox.ProjectPropertyValidator|com.fca.jira.plugins.workflowToolbox.AllowedSubtasksValidator|com.fca.jira.plugins.workflowToolbox.JQLValidator|com.fca.jira.plugins.workflowToolbox.CopyParsedTextFunction|com.fca.jira.plugins.workflowToolbox.MathCalculatorFunction|com.fca.jira.plugins.workflowToolbox.ConditionalValueSettingFunction|com.fca.jira.plugins.workflowToolbox.AddOptionToSelectListFunction|com.fca.jira.plugins.workflowToolbox.AddOptionToCascadingSelectFunction|com.fca.jira.plugins.workflowToolbox.FormatTextFunction|com.fca.jira.plugins.workflowToolbox.RegularExpressionRendererFunction|com.fca.jira.plugins.workflowToolbox.CommentAdderFunction|com.fca.jira.plugins.workflowToolbox.AddRemoveWatcherFunction|com.fca.jira.plugins.workflowToolbox.IssueLinkCreatorFunction|com.fca.jira.plugins.workflowToolbox.IssueLinkBreakerFunction|com.fca.jira.plugins.workflowToolbox.WriteLinkedIssuesFunction|com.fca.jira.plugins.workflowToolbox.ReadLinkedIssuesFunction|com.fca.jira.plugins.workflowToolbox.SetUserPropertyFunction|com.fca.jira.plugins.workflowToolbox.ReadUserPropertyFunction|com.fca.jira.plugins.workflowToolbox.ProjectPropertyFunction|com.fca.jira.plugins.workflowToolbox.ReadProjectPropertyFunction|com.fca.jira.plugins.workflowToolbox.WorkLogger|com.fca.jira.plugins.workflowToolbox.AssignToProjectRole|com.fca.jira.plugins.workflowToolbox.WriteIssuesJQL|com.fca.jira.plugins.workflowToolbox.ReadIssuesJQL|com.fca.jira.plugins.workflowToolbox.InhibitEphemeralFieldErasure|com.fca.jira.plugins.workflowToolbox.CloneIssueLinksFunction|com.fca.jira.plugins.workflowToolbox.TextExtractorFunction|com.fca.jira.plugins.workflowToolbox.CopyCascadingSelectToTextFunction|com.fca.jira.plugins.workflowToolbox.SetReporterFromCurrentUserFunction|com.fca.jira.plugins.workflowToolbox.SendEmailFunction|com.fca.jira.plugins.workflowToolbox.CreateIssue|com.fca.jira.plugins.workflowToolbox.CopyToIssueDescriptionFunction

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Hi @Henning Tietgens ,

It works like a charm, validators and postfunctions now appears.  I'll do more couple of test and we'll let you know. Thanks for your help. Really appreciated! 

Just want to ask if I can scan all the workflows, not only on a specific workflow. Thank you!


Best Regards,
Alvin

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Hi @Henning Tietgens ,

Aha! I've managed to scan all the workflows by replacing it to this line :

workflows.each{workflow -> 

Thank you so much for your help! 

Best Regards,
Alvin

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Oh, you're right. I forgot to remove the workflow restriction in the answer. I corrected the answer. Thanks for the hint!

Henning

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Hi @Henning Tietgens ,

Thank you for this wonderful solution, just want to ask if we can also tweak the script to check plugins that is used in a project, not just on a workflow. Currently , I'm using Power Admin to check it , but its good to have an alternatives. Thank you!

Best Regards,
Alvin

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2019

Hi Alvin,

I think it's possible to add this functionality to the script, but you may have to do this on your own :-)

Best regards,
Henning

Matt Doar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2021

This one worked like a charm for me, thank you! It's a great example of using an uncommon and. not well-documented Java API for Jira workflows, regex, and an XmlParser. Very useful

Like Henning Tietgens likes this
3 votes
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2018

Hi,

here is a refined version of my script.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.JiraWorkflow
import com.atlassian.jira.workflow.WorkflowManager
import java.util.regex.Matcher

String searchText = 'customfield'

WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager()
Collection<JiraWorkflow> workflows = workflowManager.getWorkflows()

String result = "Workflow;Function;Type;Action;Source-Step<br>"

workflows.each{workflow ->
def workflowXml = workflow.descriptor.asXML()
Matcher m = workflowXml =~ /${searchText}/
if (m.find()) {
String workflow_name = "${workflow.name}${if(!workflow.isActive()){"(inactive)"} else ''}${if(workflow.isDraftWorkflow()){"(draft)"} else ''}"
def wf = new XmlParser().parseText(workflowXml)
List<Node> wf_flat = wf.depthFirst()
wf_flat.each{
if (it.text() ==~ /.*${searchText}.*/){
def nodeInfo = getNodeInfo(it,searchText)
if (nodeInfo){
result += "$workflow_name;$nodeInfo<br>"
}
}
}
}
}
result

String getNodeInfo(Node n, String search) {
String nodetext = ''
def valid_action = false
def valid_function = false
def valid_step = false
if (n.name() == 'function') {
def m = n.value() =~ /[^\[{]*/ + search + /[^\]}]*/
if (m) {
nodetext += m[0].toString() + ";"
}
def p = n.parent()
while (p) {
switch (p.name()) {
case 'post-functions':
valid_function = true
nodetext += "post-function;"; break
case 'validators':
valid_function = true
nodetext += "validator;"; break
case 'conditions':
valid_function = true
nodetext += "condition;"; break
case 'action':
valid_action = true
nodetext += "${p.attribute('name')} (${p.attribute('id')});"; break
case 'step':
valid_step = true
nodetext += "${p.attribute('name')} (${p.attribute('id')})"; break
case 'global-actions':
valid_step = true
nodetext += "GLOBAL"; break
case 'initial-actions':
valid_step = true
nodetext += "INITIAL"; break
}
p = p.parent()
}
}
if (valid_action && valid_function && valid_step) {
return nodetext
} else {
return ""
}
}

Dave, please try this.

Henning

David Gordon August 22, 2018

Hi Henning

Many thanks for all your efforts

I'm getting the error shown below

error.PNGThis links https://community.atlassian.com/t5/Jira-questions/Scriptrunner-for-jira-Copy-Project-Error-Timeout-No-stack-trace/qaq-p/209892 says this can be expected and the routune still runs. If so, is there a directory location  ca search for the output?

Regards

Dave  

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 22, 2018

In this case you have to replace the line 

result += "$workflow_name;$nodeInfo<br>"

with

log.error "$workflow_name;$nodeInfo"

Or you can add this line below the above line if you want both outputs. This way the output is in the atlassian-jira.log (you can view the location of the atlassian-jira.log in the 'File Paths' section of the system information page.).

Henning

David Gordon August 24, 2018

Many thanks Henning, that seemed to work

All the best

Dave

David Gordon August 24, 2018

Sorry Henning, but it seems to be case sensitive as is correctly matching the lowercase "customfield"  text. 

When I try to run for "CustomField" it runs iis a split second and does not produce any output.

Any idea?

Regards

Dave

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2018

Hi Dave,

Yes, the search is case sensitive. It's searching for workflow postfunctions, conditions and validators from specific plugins by parsing the XML output of the workflow.

If you know what you are searching for and you know a workflow which uses the functionality you can export this workflow as XML and try to find the specific identifier of it. This identifier can than be used in my script to find all workflows using it.

What are you searching for while searching for "CustomField"?

Best regards,
Henning

David Gordon August 24, 2018

Hi Henning,

I'm trying to identify all references to a custom fields that use the native number extension (e.g. customFieldManager.getCustomFieldObject(11203L)).

In your script I am using:

String searchText = 'getCustomFieldObject'

but all I'm getting back in a sub-second response In the Results tab is 

Workflow;Function;Type;Action;Source-Step

Because I've have now also searched the XML export with no luck I presume the problem is that the code is references within Post Functions the ScriptRunner workflow function - Custom script post-function (inline script).

Any idea how to search through this?

Regards

Dave

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2018

Hi Dave, the scriptrunner parameters are base64 encoded since 4.3.3, see https://scriptrunner.adaptavist.com/4.3.3/jira/releases/current-release.html#_base64_encoding_for_workflow_function_arguments. On this page is a link to a script to decode workflow XMLs containing scriptrunner base64 encoded parameters. You could try to incorporate this script into my script to decode all parameters after getting the XML and before searching, between those lines.

    def workflowXml = workflow.descriptor.asXML()
Matcher m = workflowXml =~ /${searchText}/

Henning

Like Damien Davis likes this
Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2019

Hi @Henning Tietgens ,

Good day! Just want to ask why is that only post-function returns onto result tab?

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2019

Hi Alvin,

It should not. Maybe your search term is to specific?

Henning

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2019

Hi @Henning Tietgens ,

I'm using this:

String searchText = 'com.innovalog.jmwe.jira-misc-workflow-extensions'

and still no validators even if I put one validator just to check. It returns post-functions perfectly but not the validators. 

Results:

Sample project - Subtask (Simplified);com.innovalog.jmwe.jira-misc-workflow-extensionsCopyFieldValueFromParent-function;post-function;Create (1);INITIAL

Sample Project - Subtask (Simplified) v1(inactive);com.innovalog.jmwe.jira-misc-workflow-extensionsCopyFieldValueFromParent-function;post-function;Create (1);INITIAL

can you suggest? Thank you!

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

Mmmh. Maybe you could try to export the workflow with the condition as XML and take a look into the xml file to determine which search string should match.

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

Hi @Henning Tietgens ,

Thank you for your very quick response, even tho I export the workflow and look for the validator descriptor, it does not display on the script console Results, it just return:

Workflow;Function;Type;Action;Source-Step

Do we have any other work-around here? Thank you!

Best Regards,
Alvin

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

Could you try my new answer? I hope this helps. Be sure to use the App Key for your app (could be found by expanding the app infos in "Manage Apps").

Best regards,
Henning

Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

Hi @Henning Tietgens ,

Thank you for keeping an extra eye on this problem, but there is no workflow step returned.

Workflow;Function;Type;Action;Source-Step

Customfields
Calculated Date-Time Field (JWT Migration) (Calculated Date-Time Field (by JWT), com.atlassian.jira.plugin.system.customfieldtypes:datetimerange (Allow searching for a date and time that is between two other dates and times))
Calculated Text Field (JWT Migration) (Calculated Text Field (by JWT), com.atlassian.jira.plugin.system.customfieldtypes:textsearcher (Search for values using a free text search.))

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

If you are sure, you use the correct App Key for the script I'm out of ideas. In your first comment you wrote the key for "Jira Misc Workflow Extensions", now it's "Jira Workflow Toolbox", so I'm not sure if everything matches (is the validator from "Jira Workflow Toolbox"?).

Henning

Michael Aglas September 6, 2019

I love it - made my day

Ritu Garg April 13, 2021

Thank you. You have written a very useful script.

1 vote
francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 26, 2013

We are currently using a query on the database, but I'm wondering if there is another approach.
The query is something like

select workflowname
from jira.jiraworkflows
where descriptor like '%iamhuy%'

0 votes
Hartej Arora May 14, 2021

Hello @Henning Tietgens ,

 

Just wanted to thank you for sharing this. Worked like a charm for me. I was looking for exactly this that could report on how many of the workflow plugins' modules are being actively used in our instance (without going through each workflow manually). 

 

Thank you!

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2021

Thanks :-)

0 votes
Zoltan Kiss January 4, 2021

Hi!

I know that it's an old topic, but can anyone help in finding only those workflow transitions (workflow name and transition name), where a scriptrunner script has ben used?

Thanks in advance!

Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 4, 2021

Hi @Zoltan Kiss ,

when you're interested in the usage of 3rd party apps within your workflows - in this case ScriptRunner - I'd like to recommend Admin Toolbox for Jira (https://marketplace.atlassian.com/apps/1214246/admin-toolbox-for-jira?hosting=server&tab=overview) and it's built-in workflow report (https://apps.decadis.net/pages/viewpage.action?pageId=13076594) - besides many other useful features for administrators.

Disclaimer: I'm part of the team behind the aforementioned app.

Cheers
Thorsten

0 votes
David Gordon August 20, 2018

Many thanks Henning

I noticed some warnings as shown below

warning.PNG

and when ran it seemed to picked up everything instead of just the lines with 'customfield' listed.

output.PNGAny idea what the problem is?

Regards

Dave

0 votes
David Gordon August 20, 2018

Hi there,

When I run the above code in the ScriptRunner Console I get the following error:

 

Error

startup failed: Script45.groovy: 13: expecting '}', found '-' @ line 13, column 25. workflows.each{workflow -&gt; ^ 1 error

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script45.groovy: 13: expecting '}', found '-' @ line 13, column 25. workflows.each{workflow -&gt; ^ 1 error 

 

Any idea how to resolve?

Regards

Dave 

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2018

Please try copying the source again. There were some html conversion problems while converting from Atlassian answers to the community site.

Henning

0 votes
Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2013

You could export all workflows as xml-files and then search in these files for that plugin (e.g. com.googlecode.jsu). But I guess searching in in the database is faster.

Suggest an answer

Log in or Sign up to answer