
qnw1b (qnw1b) asked a question.
When users are created in Okta based on Active Directory there is only available manager's distinguishedName in user's profile.
I know that when there is only one domain connected to Okta there is this command that can return manager's emain - getManagerUser("active_directory").email.
Question is how can I get the same result when I have more than one domain?

I think what you have should work fine but when more than one AD is leveraged however and you are not seeing the expected value you might need to change your AD priority. The AD with the higher priority will be what will write to the user object. Here is how you check AD priority. https://help.okta.com/en-us/content/topics/users-groups-profiles/usgp-prioritize-profile-source.htm
While not exactly your same question, the following post talks about AD priority impacting a user's account and might help better explain what is going on.
https://support.okta.com/help/s/question/0D54z00009JbGlUCAV/what-account-decide-when-username-match-option-is-allow-short-match-option?language=en_US