Clear a custom metadata field of type 'Set'

Hi,

I’ve created a custom metadata field (called Ref Type), which I have made of type Set and have some values in the list in the preferences. On a document, I’ve accidentally selected a value, but I want to clear that value, that is, to have the Ref Type have no value. Is there a way to do this?

Best,
Lyndon

No, not at this time. However, you could add something simple like a N/A, --, or No <name of attribute> to indicate a null value, e.g.,…

Thanks. As a workaround, I just tried changing the Type to Single line text, which seemed to work, and then deleted the value. I’ve then changed the Type back to Set, which also seems to have preserved the blank value.

Is it possible to clear the value by AppleScript?

A belated gift of the season…

-- Clear Metadata
-- Created by BLUEFROG/Jim Neumann on Thu Dec 29 2022
-- Copyright 2022 DEVONtechnologies, LLC. All rights reserved.

(*Clears custom metadata from selected items
This should work with all datatypes.
Note: Date fields will always have a default value. Clearing it will set it to this value, not empty it.*)

property attributesToClear : {"Abstract", "Status", "The Date"} -- A list of attributes to clear. This can be a list of one, if needed.

tell application id "DNtp"
	if (selected records) = {} then return
	
	repeat with theRecord in (selected records) -- Process the selected record(s)
		repeat with theAttribute in attributesToClear -- Process any attributes listed
			add custom meta data "" for theAttribute to theRecord -- Clear the value
		end repeat
	end repeat
	
end tell
1 Like

Wonderful! Thank you

My pleasure :slight_smile: