Example of adding AD groups to groups claim in access token

Yes, assuming the group IDs and group name expression you wrote evaluate properly, that is the pattern you would follow to get group claims into an access token.

There is more information at the following links:

https://developer.okta.com/docs/how-to/creating-token-with-groups-claim.html

https://developer.okta.com/reference/okta_expression_language/#getfilteredgroups-details