Your sentence is correct although the use of whom and whomever is declining among native English speakers.
The majority of those whom one hears in the media and conversation these days seem to prefer who and whoever just as most people now speak of less items rather than fewer.
In spite of the efforts of language enthusiasts, these forms would appear to be doomed in popular speech in the long term (much to my regret).
The rule that you refer to is that whom and whomever are used for the direct and indirect object as well as following prepositions (as in your example).
Some instances can be quite tricky to decide, as in:
That is the man who, she said, stole my friend's handbag.
and
That is the man whom, she said, I saw steal my friend's handbag.
https://www.grammarly.com/blog/who-vs-whom-its-not-as-complicated-as-you-might-think/