Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Problems with "No Signature of Method"

Alvaro Fabian Hernandez Ramirez
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 26, 2021

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

Comment

Log in or Sign up to comment
Nic Brough -Adaptavist-
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.
July 27, 2021

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

Alvaro Fabian Hernandez Ramirez
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2021

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

Nic Brough -Adaptavist-
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.
July 27, 2021

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?

Alvaro Fabian Hernandez Ramirez
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2021

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

Nic Brough -Adaptavist-
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.
July 27, 2021

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.

TAGS
AUG Leaders

Atlassian Community Events