Empty a "Text Field (read only)" when an issue is cloned?
Asked by Gisela Lassahn:

Hi all together,

we use Jira Software Data Center 9.4.8 with ScriptRunner.

We've got a custom field of type "Text Field (read only)" and don't want it to be copied when an issue is cloned.

How can we manage this?

Best regards,  
Gisela Lassahn


Answers:
author: Ram Kumar Aravindakshan _Adaptavist_
body: Hi [@Gisela Lassahn](/t5/user/viewprofilepage/user-id/3045010)

What you are trying to do is not doable directly with Automation.

Instead, I suggest just using ScriptRunner to achieve this.

Please clarify when exactly you want to trigger the issue cloning. Is it when you transition the issue?

Thank you and Kind regards,

Ram

comments: author: Gisela Lassahn
body: Hi [@Ram Kumar Aravindakshan _Adaptavist_](/t5/user/viewprofilepage/user-id/2988015) ,

the issues are cloned manually via the "Clone" action in the "More" menue within the original issue itself.

In Automation there's no trigger for the clone action but for "Issue created"; so I'm using this one instead.

We are new in ScriptRunner and still don't know all the possibilities.

It would be great if you could help us solving the issue with ScriptRunner.

Many thanks and kind regards,  
Gisela


author: Ram Kumar Aravindakshan _Adaptavist_
body: Hi [@Gisela Lassahn](/t5/user/viewprofilepage/user-id/3045010)

I have previously provided an answer in the Community of how you can Clone an Epic along with all its Issues and Sub-Tasks via Post-Function.

It is available in the [Adaptavist Library](https://library.adaptavist.com/entity/clone-an-epic-along-with-its-issues-and-subtasks).

So using a similar approach, you could use ScriptRunner add-on for Automation and add the code to trigger the cloning.

Please clarify based on what condition you intend to trigger the cloning.

Thank you and Kind regards,  
Ram


author: Gisela Lassahn
body: Please vote for [\[JSWSERVER-25829\] Ability to clear the Read-only custom field using the Automation - Create and track feature requests for Atlassian products.](https://jira.atlassian.com/browse/JSWSERVER-25829)


author: Fabio Racobaldo _Herzum_
body: Hi [@Gisela Lassahn](/t5/user/viewprofilepage/user-id/3045010) ,

for my knowledge you can't do that. Automation has not a trigger for that event and a custom listener has not a specific event for issue cloning.

For a cloud instance there is an app for that ([https://marketplace.atlassian.com/apps/1218652/deep-clone-for-jira?hosting=cloud\&tab=overview\&source=community58](https://marketplace.atlassian.com/apps/1218652/deep-clone-for-jira?hosting=cloud&tab=overview&source=community58)) but it seems to be not available for data center instance.

Fabio

comments: author: Gisela Lassahn
body: Hi [@Fabio Racobaldo _Herzum_](/t5/user/viewprofilepage/user-id/781528) ,

thanks for you hint.

Maybe we'll migrate to Jira Cloud in the future.  
Then we'll test if the app is helpfull for us.


author: Marc - Devoteam
body: HI [@Gisela Lassahn](/t5/user/viewprofilepage/user-id/3045010)

Create an automation based on issue created, due to the fact the clones links is added after the issue creation, you wil need a re-fetch issue action first.

Then have a condition on linked issues based on cloners link and if all is true, edit action to the cloned issue to empty the read-only text field.

comments: author: Gisela Lassahn
body: Hi [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976) ,

in our instance there are no clones links created when an issue is cloned because we didn't want those links and configured it out some years ago (see [Configuring issue cloning \| Administering Jira applications Data Center 9.4 \| Atlassian Documentation](https://confluence.atlassian.com/adminjiraserver0904/configuring-issue-cloning-1188768939.html)).

But my problem is that the edit issue action doesn't work to clear read-only text fields.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/310227i75D238977AC6BEC7/image-size/large?v=v2&px=999 "image.png")

This is how I did it. The field still is filled after cloning.


author: Marc - Devoteam
body: Hi [@Gisela Lassahn](/t5/user/viewprofilepage/user-id/3045010)

What is your complete rule, how will you now you are triggering on the cloned issue?

DO you have an identifier?


author: Gisela Lassahn
body: Hi [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976) ,

in new (not cloned) issue the field is always empty because it can only be filled lateron by another, manually triggered automation rule.

So, in this rule (triggered when an issue is created), I check if the field is empty and try to empty the field if it is not empty.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/310232i0BDFFE2763303FED/image-size/large?v=v2&px=999 "image.png")


author: Gisela Lassahn
body: The audit log pretends that everything works fine, but the new (cloned) issue isn't really edited:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/310234i02201D8A449FCB37/image-size/large?v=v2&px=999 "image.png")


author: Marc - Devoteam
body: Hi [@Gisela Lassahn](/t5/user/viewprofilepage/user-id/3045010)

I tried it myself and yes the field will not empty, but I did find a work around.

Set the read only text field to a non-breaking space.

To generate the non-breaking space character, hold Alt and type 255 on your numeric keypad.

There is also an open issue on this [AUTO-614](https://jira.atlassian.com/browse/AUTO-614)


author: Gisela Lassahn
body: Hi [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976) ,

many thanks again!

I know AUTO-614 and allready voted for it some time ago. But I think it won't be put into action in the near future, and probably it's only going to be put in action for Jira cloud, because the project name is "Automation for Cloud".

The workaround you're describing is what we actually are using at the moment, but there are at least two negative side effects:

1. The field is shown in the view screen while really empty custom fields are not.

2. The issues are found when you use JQL to find issues with "... is not EMPTY" though they should not be found.

So I'm still searching for a better idea to solve my problem.


Tags: automation

jira-software-data-center

scriptrunner