To elaborate a bit more, I was reading through the Bestiary after finding a post on Reddit. The major point of said post was that the Golem Antimagic trait would trigger no matter what so long as it was the target. Crit fail your attack roll? You still hit the thing. Does the spell require a save of some sort? Doesn't matter.
This is do to the wording of the feature only saying "Any magic of this type that targets the golem". Which the poster believes means that if you were to use Produce Flame and throw the fire at a Flesh Golem it would trigger the Harmed By: damage no matter what.
This only effects the spells that can actually effect the Golem. Meaning a few low level Wizards with the right cantrips can tear down a Golem no matter what. Have a couple slinging the proper cantrip to damage it and another to enact the slow.
Of course I could be entirely wrong and the trait actually does intend for any spell that can harm a Golem to just trigger the effect no matter the action.