def get_report_script_field(field_path, is_known=False):
    property_split = field_path.split('.')
    property_path = '_source%s' % ''.join("['%s']" % x for x in property_split)
    if is_known:
        script_string = property_path
    else:
        full_script_path = "%s['#value']" % property_path
        script_string = """if (%(prop_path)s != null) { %(value_path)s; }
        else { null; }""" % {
            'prop_path': property_path,
            'value_path': full_script_path
        }

    ret = {"script": script_string}
    return ret
Called when the addon is deleted from the owner (User or Node).
dataset/ETHPy150Open dimagi/commcare-hq/custom/_legacy/pact/utils.py/get_report_script_field--crossover with--dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/base/__init__.py/AddonSettingsBase.on_delete