MIM 2016: Flow a string value into the AD Manager reference attribute

The case

I have a text feed that has the Manager field populated with the employeeid but the anchor field of the feed is the HR number which is different from the employeeid. Now the employeeid is the recognized key identifier of users in the organization and it is placed in the employeeid field of the AD account.

What I want

Normally to get a reference value, you just have to tag that attribute in the feed as a reference attribute and MIM will figure out who that user is from searching your anchor field in the feed and then it get a reference to that object, but in this case that is not possible. I want to be able to get a reference value so I can flow that to the manager field.

The solution

Thanks to a brilliant article by Scott Eastin here, I saw that you can use a MIM provided function called

Utils.FindMVEntries(“attributeToSeachinMV“, “attributeValueToSearchfor“)

This function will return a reference to the MV object and then you can get the distinguished name and flow it to the AD csentry value.