I need to send an email either using the escalation service or through the scheduled jobs,please hel

Shrikant Maheshwari November 21, 2017

Below is my script which i am using to update the assignee feild but how to send an email through the same script, can someone please help ?

 

def CAB_ASSIGNEE
def CHANNEL_VALUE
Map<String, Object> searchResult = get('/rest/api/2/search')
.queryString('jql', 'project = SD AND UPDATED <-5d')
.queryString('fields', 'issuekey, customfield_23000, assignee')
.asObject(Map)
.body

def issues = (List<Map<String, Object>>) searchResult.issues

for(issue in issues){
def issueKey = issue.key
CHANNEL_VALUE = ((Map<String, Map>) issue.fields).customfield_23000.value
def CAB_ASSIGNEE_val = ((Map<String, Map>) issue.fields).assignee
if(CAB_ASSIGNEE_val) {
CAB_ASSIGNEE = CAB_ASSIGNEE_val.name

if (CHANNEL_VALUE == 'HCP Portal')
{
logger.info("${issueKey}, ${CAB_ASSIGNEE}")
CAB_ASSIGNEE = "priyanka.khare"
logger.info("${issueKey}, new: ${CAB_ASSIGNEE}")
}

if (CHANNEL_VALUE == 'Email template')
{
logger.info("${issueKey}, ${CAB_ASSIGNEE}")
CAB_ASSIGNEE = "shrikant.maheshwari"
logger.info("${issueKey}, new: ${CAB_ASSIGNEE}")
}
if (CHANNEL_VALUE == 'MAP')
{
logger.info("${issueKey}, ${CAB_ASSIGNEE}")
CAB_ASSIGNEE = "shrikant.maheshwari"
logger.info("${issueKey}, new: ${CAB_ASSIGNEE}")
}
if (CHANNEL_VALUE == 'GRV GCP')
{
logger.info("${issueKey}, ${CAB_ASSIGNEE}")
CAB_ASSIGNEE = "shrikant.maheshwari"
logger.info("${issueKey}, new: ${CAB_ASSIGNEE}")
}
if (CHANNEL_VALUE == 'MAP GCP')
{
logger.info("${issueKey}, ${CAB_ASSIGNEE}")
CAB_ASSIGNEE = "shrikant.maheshwari"
logger.info("${issueKey}, new: ${CAB_ASSIGNEE}")
}

def result = put('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.body([
update:[
assignee: [[set: [name: CAB_ASSIGNEE]]]
]
])
.asString()

}

 

0 answers

Suggest an answer

Log in or Sign up to answer