The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import java.sql.Timestamp
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey('xxxx-xxxx')
def months = 1
def dateACF = customFieldManager.getCustomFieldObject("customfield_xxxx")
def dateAValue = issue.getCustomFieldValue(dateACF) as Date
log.warn dateACF
log.warn dateAValue
def dateB = Calendar.getInstance()
dateB.setTime(dateAValue)
dateB.add(Calendar.MONTH, +months)
dateB.getTime()
log.warn dateB.getTime()
LOGS:
2021-09-08 11:44 WARN [runner.ScriptBindingsManager]: EMP Effective Date 2021-09-08 11:44:08,595 WARN [runner.ScriptBindingsManager]: 2021-08-02 00:00:00.0 2021-09-08 11:44:08,596 WARN [runner.ScriptBindingsManager]: Thu Sep 02 00:00:00 MDT 2021
Hi @Justin Mele,
if I understood correctly, you want to add months to fetched value. if so you can try below snippet
def dateB = dateAValue as Date
dateB.setMonth(dateB.getMonth() + months)
hope this helps
BR,
Leo
Leo,
I did get that part of the script figured out. thank you! what I am trying to do now is place them in another custom field as an employee review. So it would go out 30, 60, 90, 180, and 12 months from their effective date.
Thank you,
Justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.