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

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

146 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you