It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Help with creating a field that copies the value of another field and NOT be edited Edited

Hi,

 

I want to create a scripted date field (FIELD 1) that copies the value of another date field (Due Date).

But, after issue creation, the field FIELD 1 must be LOCKED. 

 

Can someone please help me with how to achieve this . thank you 

1 answer

0 votes
Joe Pitt Community Leader Sep 18, 2019

Only put the new field on the View screen. 

@Joe Pitt  Thank you for the comment !

Okay, but how I copy the value of the Due date field to the new field and then lock the new field ?

In the new scripted field write this code.

issue.dueDate

May be 2 more configurations if you are dealing with date field.

Searcher: Date Time Range picker
Template: Date Time

You may need to add more code to handle errors. It is bare minimum.

Ravi

@Ravi Sagar -Adaptavist-  Thank you for the comment.

I have not written scripts. 

does the above line copy the field value to the new field. But how do I ensure that that the value entered first is fixed

Joe Pitt Community Leader Sep 18, 2019

There are some plugins, I use jira suite utilities (JSU) to copy fields during a transition. JIRA has the ability to copy some fields. I don't know if due date is one of them. The plugins expand the list of fields. You must copy to another date field. JIRA has no way of 'locking' a field. that is why I said to only put the new field on the view screen. The only way to update it would be with a script or post function. A user can't edit it. 

Like Andrew Laden likes this

Hi @Aisha M 

Yes that is the job of the scripted field, it will have the due date. What do you mean by "..value entered first is fixed"?

I should have asked, why are you doing this? What is your objective?

Ravi

With @Ravi Sagar -Adaptavist- 's answer, he mentions a "scripted field" - these are created by Adaptavist's ScriptRunner, and don't contain editable data - they calculate something (even if it's just a copy of the data of another field) and expose it as a field, but it can't be edited, even if you put it on the edit screen.

There are other apps that can do something similar.  I'm less familiar with them because I work for Adaptavist too, and hence just use SR 99% of the time.

@Ravi Sagar -Adaptavist- 
Hi . I mean to say the new field must copy the first DUE DATE value entered. Later, if the DUE DATE is changed, the new field must NOT take the new value. Basically, the first value copied must be fixed.

We want to do this for some certain tracking purposes. 

 

Thank you

Now it is clear. In that case use a post function to update the "Original Due Date" custom field not a scripted field. What you are doing is baselining. Also take a look at some apps like BigPicture or Portfolio, these have such features built in but for the time being post function should do the job.

@Ravi Sagar -Adaptavist- But how do I make sure that the new field value when someone changes the Due Date ? What conditional statement should I use for this. Can you please help.

Thank you !

The post-function runs at a certain point in the workflow.  If you do not go through that transition again, the value in the field will not change.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you