Okay, first of all you'll need to have a Lync client installed along with your AX client. And you need to be logged into Lync with your account for that.
Next you'll need to add some contacts in AX. You must create an address of type e-mail and fill the address with the e-mail address this contact uses for instant messaging (IM). Please observe that some people have different e-mail addresses for regular e-mail and for IM.
In the contact form you must click the More options / Advanced button and check the "Instant messenger sign-in" check box. This tells AX to use this particular address of the contact when integrating with Lync. If the address is only used for IM and not also for regular e-mail, check the "Instant message" check box too.
When you want to show the presence indicator next to a field on a form, there are three properties of the form field to consider:
- PresenceIndicatorAllowed. I assume you can guess what this controls.
- PresenceDataSource and PresenceDataField. This is the datasource and datasource field from the form that holds data used to find the right contact with.
The last thing, is to control how the contact person is found and set up a PresenceInfo object.
There are different approaches for different kinds of key data. Here AX looks at the extended data source of the PresenceDataField that you specified on the form field.
On the extended data type there are two properties pointing to the class method doing the job of finding the contact person. The properties are PresenceClass and PresenceMethod. I think all standard implementations of these point to the DirPresenceInfo class as the PresenceClass. If you examine this class you can see how it based on different kinds of keys finds the right contact person and creates a PresenceInfo object for the contact.