Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,601
Community Members
 
Community Events
165
Community Groups

Problems with "No Signature of Method"

hi everyone, i have a issue with automation and scriptrunner, the following error is shown the run of the automation.

Script function failed on Automation for Jira rule: valida cambio test 1, file: <inline script>, No signature of method: com.atlassian.jira.issue.fields.ImmutableCustomField.getValue() is applicable for argument types: (String) values: [STI-436] Possible solutions: getValue(com.atlassian.jira.issue.Issue), getName(), getClass(), hasValue(com.atlassian.jira.issue.Issue), getAt(java.lang.String)

The script i have implemented is the following

-------------------------------------------------------------------------------------

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import java.sql.Timestamp;
import java.text.DateFormat
import java.util.Date
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
import com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactory
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade

@WithPlugin("com.riadalabs.jira.plugins.insight")
@PluginModule ObjectAttributeBeanFactory objectAttributeBeanFactory
@PluginModule ObjectFacade objectFacade
@PluginModule ObjectTypeAttributeFacade objectTypeAttributeFacade

def issueManager = ComponentAccessor.getIssueManager()
//def issueTK = issue.getKey()
def issueTK = issueManager.getIssueObject("STI-436")
log.warn(issueTK)

def cfManager = ComponentAccessor.getCustomFieldManager()

// here is the error
CustomField grupoasignado = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(11704) //ID custom field Grupo Asignado
// here is the error

def myValue = grupoasignado.getValue(issueTK)
def myObjectBean = myValue[0]

CustomField insightCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(11704)
def insightObjects = issueTK.getCustomFieldValue(insightCustomField)

def obj = insightObjects[0]

def atributeObjectId = obj.objectAttributeBeans.find {
objectTypeAttributeFacade.loadObjectTypeAttributeBean(it.objectTypeAttributeId).name == "Grupo"
//log.warn(objectTypeAttributeFacade.loadObjectTypeAttributeBean(it.objectTypeAttributeId).name)
}?.objectTypeAttributeId

def myAttrValue = objectFacade.loadObjectAttributeBean(myObjectBean.getId(), atributeObjectId).getObjectAttributeValueBeans(); // ID atributo grupo

def grupo = myAttrValue[0]

final String groupName = grupo.getValue()

def groupManager = ComponentAccessor.getGroupManager();
Boolean flagValidation = issueTK.assignee ? ComponentAccessor.groupManager.isUserInGroup(issueTK.assignee, groupName) : false

 Please help me! thanks!!!

 

1 comment

Do you have a valid issue object in issueTK ?  The error message is telling you it is a string rather than an issue object.

yes, i have a valid object, the script is tested in Scriptrunner, but, the automation validation or the workflow Scriptrunner validation, show the problem reported

the script works, but in the addons show the error

Thanks for your help

Ok, I'm confused now.  Where exactly are you running this script?  What's automation got to do with it?  If the script works, what have addons got to do with it and how are the errors coming out?

I answer below:


Where exactly is this script running?
A: The script is first executed in ScriptRunner to verify that it is working and that there are no execution errors, in addition to being able to validate the result. After that, it goes to Automation for JIRA, where a validation is executed when the state changes, and that is where the error appears, in addition to that, when a workflow is edited and the validation is saved through a custom execution of validation by groovy, also throws the error.

What does automation have to do with this?
A: In the automation I generate a validation task to be able to execute the ScriptRunner code, but this could be ignored, since, when I modify the flow and add a validation, it also throws the error.

If the script works, what do plugins have to do with it and how do I get errors?
A: The plugins were alternatives for the execution, you can send the Automation for JIRA plugin for the test in particular, what if, the error can be seen directly in the validation of the transition in the edited Jira workflow, where the execution history and the ScriptRunner error appears.

Thanks for your help

I am sorry, but that makes no sense - it does not explain what you are doing.

Specifically:

>The script is first executed in ScriptRunner

Where in SR is it being run?  Post-function?  

After that, it goes to Automation for JIRA, 

What do you mean "it goes to Automation"? 

and so-on.  I can't see where you are executing this script or how.

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

289 views 2 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you