Hello Team,
I want a script to restrict copying of All fields to the subtask using behavious ,
I want to exclude some of the fields from copying ,Please help me in this concern,
Thanks
Varun
When creating an issue of the type "Feature" all the entered information - before clicking "create" - is copied to all sub-tasks.
This is unwanted for the following fields:
• Epic Link
• Original Estimate
• Fix Version
• Description (since the Description is a mandatory field, please just use the summary of the sub-task instead)
Hi Varun,
I assume you are using the 'Create a sub-task' post-function on a transition? I think you should be able to achieve the desired result by simply nulling out the unwanted fields in the Additional code section, for example:
issue.fixVersions = []
See the ScriptRunner documentation for more details.
Regards,
J
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply Jake,
It is working fine with fixversions ,
but when I am adding the script for other fields it is not working.
Please let me know how to add other fields.
Thanks & Regards,
Varun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varun,
What does the script look like for the other fields? Bear in mind that the 'empty' value for a field is not always the empty list []: depending on the field type, it might be null, or the empty string, etc.
J
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jake,
issue.fixVersions = []
issue.epicLink = []
issue.TimeTracking = []
I am using same as above, I tried with empty and null but in vain,
could you please help in this full code, Please .
Thanks in advance,
Varun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Presumably you are noticing failures in the script since epicLink and TimeTracking are not properties of the issue object.
If you need to clear the Original Estimate field (as you said you needed in your original question) then you can set issue.originalEstimate = 0 (or perhaps null if you don't want to specify explicitly that it should be zero).
Epic Link is technically a custom field, so you would need to do something along the lines of the following:
import com.atlassian.jira.component.ComponentAccessor
def epicLinkCf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Epic Link")
issue.setCustomFieldValue(epicLinkCf, null)
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.