I'm looking to update the values of a single-select custom field based on data retrieved from an external database set up as a resource in Scriptrunner. I have the initial query to get the new dataset and then want to do the following:
- Compare the current list to the new list and:
- Retain values in the current list that match the new list
- Remove any values from the current list (customfieldoption table) that don't match the new list but only if the value in the current list hasn't been used on a ticket (no records in the customfieldvalue table)
- Do not update any existing values that have been used on a ticket (record in the customfieldvalue table)
- Append new values to the current list (insert into customfieldoption)
I'm guessing that someone has done something like this before ...
Thanks in advance for any and all assistance!
Rich