We are starting to use scripted fields more and more and I was curious about the server load this may cause. Is it anything to worry about? Currently we use 1-2 scripted fields per issue in a system with 33k issues and I haven't noticed any problems whatsoever.
Thanks for your time.
It depends what you do with them. It's really impossible to say much more without knowing what your code does.
You could time a full reindex with and without the script fields... the time difference will give you a very basic idea of the amount of additional work they are doing.
But in terms of ability to blow yourself up, script fields are at the more dangerous end of the spectrum. Novices should probably steer clear until they are familiar with jira, and the API.
Hi Jamie,
thanks for the super fast reply! I'll take it into consideration and make sure we are careful when there is no way around scripted fields.
We use the scripted fields to pass Cost ID values along Issue Links. We have a three / four level issue hierarchy and the Cost ID is entered at the top and inherited from there.
This is the cost ID script, the others are only a few line. This is more for information, obviously I can't expect a code review...
import com.atlassian.jira.issue.Issue; import com.atlassian.jira.ComponentManager; import com.atlassian.jira.issue.CustomFieldManager; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.customfields.view.CustomFieldParams import com.atlassian.jira.issue.link.LinkCollection; import com.atlassian.jira.issue.link.IssueLinkType; import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager(); String second = "Cost-ID not defined" if (issue.issueTypeObject.name == "Sub-Task") { if (issue.parentObject != null) { if (issue.parentObject.issueTypeObject.name == "Demand Task") { def Issue parent = issue.parentObject; def field2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Project Cost-ID"); def String type = parent.getCustomFieldValue(field2); if (type == null) { CustomField cf = customFieldManager.getCustomFieldObjectByName("Client Cost-ID"); Map cfVal = parent.getCustomFieldValue(cf) as Map; if (cfVal) { second = cfVal.get("1"); } } else{ def field3 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Project Cost-ID"); second = issue.parentObject.getCustomFieldValue(field3); } } else{ def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Cost-ID"); second = issue.parentObject.getCustomFieldValue(field); } } } if ((issue.issueTypeObject.name == "EPIC Task")||(issue.issueTypeObject.name == "Implementation Task")||(issue.issueTypeObject.name == "Activity")) { List inwardIssues = ComponentAccessor.getIssueLinkManager().getLinkCollectionOverrideSecurity(issue).getInwardIssues("Hierarchy"); if ((inwardIssues != null) && (inwardIssues.size() == 1)) { def parent = inwardIssues[0]; def field2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Project Cost-ID"); def String type = parent.getCustomFieldValue(field2); if (type == null) { CustomField cf = customFieldManager.getCustomFieldObjectByName("Client Cost-ID"); Map cfVal = parent.getCustomFieldValue(cf) as Map; if (cfVal) { second = cfVal.get("1"); } } else { def field3 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Project Cost-ID"); second = parent.getCustomFieldValue(field3); } } } if ((issue.issueTypeObject.name == "Defect")||(issue.issueTypeObject.name == "User Story Task")) { List inwardIssues = ComponentAccessor.getIssueLinkManager().getLinkCollectionOverrideSecurity(issue).getInwardIssues("Hierarchy"); if ((inwardIssues != null) && (inwardIssues.size() == 1)) { def parent = inwardIssues[0]; def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Cost-ID"); second = parent.getCustomFieldValue(field); } } return second;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think that's a problem. What I would look for is things like connecting to external databases etc... only way of telling though is with a profiler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.