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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

0 votes
Ivan Lima Community Leader Feb 07, 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?

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 Feb 08, 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.

JIRA (Datacenter )8.5.1

Ivan Lima Community Leader Feb 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
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

157 views 0 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you