Morning! I'm stuck totally and need help as advice or working script.
Im trying to write script-listener wich will be update fields, which fields will be depends of each other, more information you will find in script comments, code, and block with 2 moments
important notes: pls, dont pay attention on warns if field_1, field_2, field_3. Beacause i have simmilar script but with easier logic and it works.
2 moments:
First dificult: it will be 20 kind of IF-Values - if (newValue_DigitalPlatform.toString() in "[ЦФТ]".... "[CRM]" .... "[1C]" and ect. NOW this part of code is triggered if match in field 100%. How to write script next way: i have 3 values in field...how to trigger ech of those parts [ЦФТ], [CRM], [1C] CRM-part and 1C-part i will write later.
Second dificult: Example my field 4 has value [ЦФТ]. IF value 4 == [ЦФТ]THEN value_3==[ЦФТ XS]. But... when they are triggered both values gets null-value. How? WHat is wrong? 
And i think one more moment for future: how to update em kind of add one more value, but dont clear previous value?
Listener script (also, i put screen of the script, cause its more readeble):
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.customfields.option.Option
def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = event.issue
//field_1 - select (single)
//field_2 - select (single)
//field_3 - select (multiple)
//field_4 - select (multiple)
def field_1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Тип запроса")
def field_2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Предварительный размер")
def field_3 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Размер (ы) заявки")
//deigital platform, here i put ID, cause we have 2 fields with similar name
def field_4 = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(15903)
def newValue = issue.getCustomFieldValue(field_1)
def getStat = issue.getStatus().name
//options
def fieldConfig = field_2.getRelevantConfig(issue)
def optionValue = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.toString() == 'XS' }
//part 2: lets construct the logic between field_3 and field_4
def newValue_DigitalPlatform = issue.getCustomFieldValue(field_4)
def fieldConfig_forSizes = field_3.getRelevantConfig(issue)
def optionValue_CFT = ComponentAccessor.optionsManager.getOptions(fieldConfig_forSizes)?.find { it.toString() == '[ЦФТ XS]' }
if (newValue.toString() in "Изменение ПО" && getStat in ["Выбрано", "Реализация", "Реализован", "Доставка клиенту", "Закрыт"]){
log.warn("TEST1")
field_2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(field_2), optionValue ), new DefaultIssueChangeHolder())
// First dificult it will be 20 kind of IF-Values - if (newValue_DigitalPlatform.toString() in "[ЦФТ]".... "[CRM]" .... "[1C]" and ect.
// NOW this part of code is triggered if match in field 100%. How to write script next way: i have 3 values in field...how to trigger ech of those parts [ЦФТ], [CRM], [1C] CRM-part and 1C-part i will write later
if (newValue_DigitalPlatform.toString() in "[ЦФТ]" && getStat in ["Выбрано", "Реализация", "Реализован", "Доставка клиенту", "Закрыт"]){
log.warn("TEST2")
//second dificult. Example my field 4 has value [ЦФТ]. IF value 4 == [ЦФТ]THEN value_3==[ЦФТ XS]. But... when they are triggered both values gets null-value. How? WHat is wrong? 
//and i think one more moment for future: how to update em kind of add one more value, but dont clear previous value?
field_4.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(field_4), optionValue_CFT ), new DefaultIssueChangeHolder())
}
}
//reindex script
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.util.ImportUtils
import org.apache.log4j.Category
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
boolean wasIndexing = ImportUtils.isIndexIssues();
ImportUtils.setIndexIssues(true);
log.warn("Reindex issue ${issue.key} ${issue.id}")
issueIndexingService.reIndex(issueManager.getIssueObject(issue.id));
ImportUtils.setIndexIssues(wasIndexing);
