Referencing other metadata fields in a save filter

I have an Item Type metadata field whose value depends on the values of other metadata fields. I'd like for a save filter to check those values and potentially adjust the value of the target field. What is the recommended way of getting those values?

I believe that the following methods should be possible:

1. Pull the record id from $args["record"]["id"], retrieve the item with get_record(), and extract metadata with metadata() as normal. (But this won't capture unsaved updates to the item, right?)

2. Query Omeka to get the element id for each field of interest, then pull them with $args["Elements"][$elementId].

For method 2, I'm thinking of something which pulls a single ItemType record and iterates over its Elements until the element with the right name is found. This feels awkward to me, and I suspect there is a straightforward way to accomplish this.

Thanks for any suggestions.

To get the element ID for a specific Item Type field, you can just use the Element table's method findByElementSetNameAndElementName, with the set name "Item Type Metadata." The ID for a particularly-named item type metadata field is the same no matter which item type it appears in.

Thank you!