Forums

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

How can I validate Custom Field date with Current system Date

Dalbir Singh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 16, 2022

Hi 

the requirement is below

1 #  Need to add validator to Linked issue.. where if i move the status to Early Adopter it has to validate cf values from (is related by ) linked issue.

all Custom Fields i want to validate in Linked issue ref ( Screen Shot _ Linked )

Linked.jpg

2# If the Required Scan type = 'Static Scan' (Text field ) then it has to validate Next Full Static Scan due (Date picker ) with current system Date. ( ref Screen shot_Required Scan

Is Related by

Required Scan.jpg

Not Added the Linked issue function

import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.CustomFieldManager
import java.util.Date.*


def REQUIREDSCANTYPE = 33604 as long
def NEXTFULLSTATICSCANDUE = 28546 as long

//get Custom Field value

def RequiredScanTypeCustomField = CustomFieldManager.getCustomFieldObject(REQUIREDSCANTYPE)
def RequiredScanTypeValue = issue.getCustomFieldValue(RequiredScanTypeCustomField)

def NextFullStaticScanDue = CustomFieldManager.getCustomFieldObject(NEXTFULLSTATICSCANDUE)
def NextFullStaticScanDueValue = issue.getCustomFieldValue(NextFullStaticScanDue) as Date

//Today date
def today = new Date()


//LOGIC for Required Scan type
if (RequiredScanTypeValue == 'Static Scan'){
NextFullStaticScanDue(before.(today))
}
else{
throw new InvalidInputException("Static Scan must be vaild")
}

0 answers

Suggest an answer

Log in or Sign up to answer