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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,307 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot