Auto populate the custom pre defined date field value on the create screen

Lakshmi S
Contributor
October 15, 2024

Hi Team,  

 

import groovy.transform.BaseScript

import com.onresolve.jira.groovy.user.FieldBehaviours

@BaseScript FieldBehaviours fieldBehaviours

def ticketField = getFieldByName("Ticket Category")

if (getFieldById(getFieldChanged()).getValue() == "Production Issue - Wider Network Impact")

{

  getFieldById("priority").setFormValue("Blocker")

  getFieldById("customfield_10500").setFormValue("Yes")

 

}

else if (getFieldById(getFieldChanged()).getValue() == "Production Issue - Limited Impact")

{

  getFieldById("priority").setFormValue("Critical")

  getFieldById("customfield_10500").setFormValue("Yes")

 

}

The options ---
---
----
-----
------

 

Ticket CategoryPriorityEscalation?Need by Date
    
Production Issue - Wider Network ImpactBlockerYesCurrent Date
Production Issue - Limited ImpactCriticalYesCurrent Date + 2 Days
Blocking Go-LiveCriticalNoCurrent Date + 2 Days
Accreditation TestingMajorNoCurrent Date + 4 Days
Strategic CustomerMinorNoCurrent Date + 7 Days

 

 

 

 

I am working on automatically populating the 'Priority', 'Escalation', and 'Need by Date' fields based on the "Ticket Category" field (below is the matrix). I have successfully managed to see the field value changing on the create screen when I update the "Ticket Category", but I am unsure how to set the "Need By Date" field on the create screen. Could you please provide some guidance on this using Script runner behaviors ?

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2024

Hi @Lakshmi S

I have given a similar solution in this Community Post

Give it a go and let me know if you are stuck anywhere.

Thank you and Kind regards,

Ram

Lakshmi S
Contributor
October 17, 2024

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,

The post (code) appears to be working as the date is displayed after the ticket is created. However, I would like it to display the changing value on the create screen to avoid confusing users. We use this "Need By Date" in many scenarios in the same project.


ticket category.png

 

 

If you see the attached screenshot (using my above script), when I select "Production Issue - Wider Network Impact" from the "Ticket Category" field, the Priority and Escalation? field values change to Blocker and Yes.

In the same way, I want to display the "Need By Date" field on create, based on the following matrix. Is it possible to achieve that?

Suggest an answer

Log in or Sign up to answer