Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to update Custom filed based on users email address in service Desk

Lakshmi Yaganti February 5, 2021

Generally we are getting  tickets through user's email in service desk  when user raise a ticket through mail or service desk portal  based on  user email domain    the custom filed should be updated 

 

example: we have  abc (abc@amway.com)  when abc raise a ticket based his domain(amway)  the (customfiled ) usertype should be amway. 

 

how can we do this through scripting it is possible or not


issue.getReporter().getEmailAddress() 

by using code we get  reporter mail here how do we compare email domain

2 answers

2 accepted

2 votes
Answer accepted
Nicolas Werle _Decadis AG_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2021

Hi @Lakshmi Yaganti ,
this usecase can be realized with Jira Workflow Toolbox.

It provides a post function to update fields. You'll get the company domain with the following parsing code: 
nthElement(toStringList(%{00007}, "@"),2)

Best regards, 
Nic

1 vote
Answer accepted
Ivan Lima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 7, 2021

This is definitely possible, and you can achieve this with different apps - like the one mentioned by Nic. Which one are you currently using?

Lakshmi Yaganti February 8, 2021

No , we didn't using

but i got  domain name by creating script filed and i need to compare, if script filed ==away ,  usertype must be  employee ,else useertype  contractor , in this scenario i am unable  to get script value 

 


def queueCf = customFieldManager.getCustomFieldObjectsByName("Domain")
String qname = issue.getCustomFieldValue(queueCf)
def usertype= getFieldById("customfield_15502")

if(selectedDomain.toString() == ("away"))
{

usertype.setFormValue("Employee")

}
else
{
usertype.setFormValue("Contractor")
}

Ivan Lima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 8, 2021

@Lakshmi Yaganti, It seems you're using groovy to handle your use case. Which app/add-on, and Jira version are you on? I just wanted to get some clarity on that so we can better assist you here.

Lakshmi Yaganti February 9, 2021

JIRA (Datacenter )8.5.1

Ivan Lima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 10, 2021

Well, assuming you're using ScriptRunner or any other app that handles your groovy, you could try something like:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField

def selectedDomain = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_15502")

String strSelectedDomain = issue.getCustomFieldValue(selectedDomain) as String

if(selectedDomain == "away") {

// your code

}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events