Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use ScriptRunner to copy and lock the first value from another Date field ?

Aisha M
Contributor
July 2, 2020

We have below scenario,

For the Epic issue type, the user will fill in the Due Date and the Base Due Date will be a scripted field that will capture the first Due Date value entered and lock it. So, if the user modifies the Due Date later, the scripted field does not alter the first value.

 

Thank you !

1 answer

1 accepted

2 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2020

This is very simple.  But do not use a scripted field.

Create a standard date (or date time) custom-field for "base due date".  Put it on the "view" screen for the issue, but not edit, create or any transition screens.  That gives you a read-only field.

The script then becomes simple, it just needs to read the due date and poke it into the target field in a post-function on the create transition.

Aisha M
Contributor
July 3, 2020

Hi @Nic Brough -Adaptavist- - Thank you for the reply. But, will be possible to copy and lock the first value and not alter this value even if the Due Date value is altered ?

Thanks

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2020

That's what I've just defined in my answer.

Suggest an answer

Log in or Sign up to answer