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
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

21,799 views 2 7
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