How to update values for a single select field using Scriptrunner custom job?

Richard Bone July 20, 2021

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:

  1. Compare the current list to the new list and:
    1. Retain values in the current list that match the new list
    2. 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)
    3. Do not update any existing values that have been used on a ticket (record in the customfieldvalue table)
    4. 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

0 answers

Suggest an answer

Log in or Sign up to answer