Hi guys, hope you are doing great. I hope someone can help me with the following:
I have a text custom field (single line) that stores values like 'firstname.lastname@example.org'.
I need to trim the string before the '@' and copy that value in another text field (vía post-function).
So, if the original value is 'email@example.com', I need to store the value 'xyz' in another text field.
Thank you in advance for your help.
You want something like this... completely untested. Put this function first in the list of post-functions.
import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.getCustomFieldManager() def emailCf = customFieldManager.getCustomFieldObjectByName("Email") def mailboxCf = customFieldManager.getCustomFieldObjectByName("Mailbox") def mailBox = (issue.getCustomFieldValue(emailCf) as String)?.replaceAll(/@.*/, '') issue.setCustomFieldValue(mailboxCf, mailBox)
I want to copy issue key(e.g DUP-35) to a custom field without character(-)e.g DUP35.
I have created a scripted field and got value of issue key copied to custom field, but when i try to use .replaceAll(-) function, it is returning value without trimming character(-) (e.g displaying as DUP-35 itself on custom field).
return key.replaceAll(/.-*\[/, '')
Any thoughts on how to return value without special character(-)
I would reccomend to use split method for String like this:
CustomFieldManager cstFldMng = ComponentAccessor.getCustomFieldManager(); issue.setCustomFieldValue( cstFldMng.getCustomFieldObjectByName("where to set") ,( (String) issue.getCustomFieldValue(cstFldMng.getCustomFieldObjectByName("from field"))).split("@")())
Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...
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