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
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

888 views 3 9
Read article

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