Hi,
I am configuring a script listener in script runner for JIRA and need to implement the following: I have a multiple select custom field and need to check everytime that field is updated, the value "Integrations" was present in the previous value and in the new value. So far I have this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Scrum Team"}
if (change) {
def old_field_value = change.oldstring;
def new_field_value = change.newstring;
log.warn("previous value: " + old_field_value)
log.warn("new value: " + new_field_value)
}else
log.warn("there was not change")
how do I check whether the string "Integrations" was present or not in old_field_value? Similarly, how do I check whether the string "Integrations" is present or not in new_field_value?
Thank you for your assistance
Hello Tomas:
if your old_field_value is a string, you can use a few methods that you can see here
I would personally use something like this:
if(old_field_value.count("Integrations")>0){ log.info("String: Integrations is present") }
and you can check the same with your other variable new_field_variable so long as they are both Strings
If I can be of further assistance please let me know.
Cheers!
Dyelamos
Hi Daniel....Thank you for your assistance...I used "contains" from the list of methods you sent me...good info..I appreciate it! Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.