I run this script:
import com.atlassian.jira.ComponentManager; import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.CustomFieldManager; import com.atlassian.jira.issue.fields.CustomField; import com.opensymphony.workflow.InvalidInputException import com.atlassian.jira.issue.IssueManager; CustomField number = customField.getCustomFieldObject(10005); def num = issue.getCustomFieldValue(number); if (num>3) { invalidInputException = new InvalidInputException("Too many resolutions") }
but all I get is this exception:
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: customField for class: Script19
What seems to be the problem here?
It's telling what the problem is, you're calling a method on *customfield* which you have not defined.
Use:
def customFieldManager = ComponentAccessor.getCustomFieldManager() def cf = customFieldManager.getCustomFieldObject(12345) def num = issue.getCustomFieldValue(cf)
Dear, Am using below script and facing the issue. Please assist..
import jxl.*;
import java.io.*;
def testdatafile= "F:\\TestData.xls";
log.info(testdatafile)
Workbook work= Workbook.getWorkbook(new File(testdatafile))
Sheet sheet1=work.getSheet("Sheet1")
def Base= (sheet1.getCell(0,0).getContents())
def Accoount= (sheet1.getCell(0,1).getContents())
log.info(Base)
log.info(Account)
log.info(Base1)
log.info(Account1)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ilka,
Thank you for your question.
I would kindly suggest you on trying the following:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.security.groups.GroupManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.customfields.manager.OptionsManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.crowd.embedded.api.User import com.atlassian.crowd.embedded.api.Group import com.atlassian.jira.util.SimpleErrorCollection GroupManager groupManager = ComponentManager.getComponentInstanceOfType(GroupManager.class) CustomFieldManager cfManager = ComponentManager.getInstance().getCustomFieldManager() CustomField cf = cfManager.getCustomFieldObject(10005) Object customFieldValue = issue.getCustomFieldValue(cf) System.out.println(customFieldValue);
Kind regards,
Rafael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.