Monday, October 4, 2010

Change the text for when you hover over an AX field - ToolTip

Sometimes there is a need to change the text that is display when a user hovers over a field in an AX form. By default (OOTB), the information that displays is defaulted from the table relations. This is decided in the kernel. If you change the information in the title fields for that table, you will see the automatically generated tooltip information change.

The automatic information will follow the format '[Field Name]: [main tables's first title field], [main table's second title field]'. For example, hover over the item number for a sales order's sales lines. The tool tip should read 'Item number: [InventTable.ItemId], [InventTable.InventName]'. Mine reads 'Item number: 10001, Yellow Basket' but yours will be different. Hovering over the line's unit of measure (salesLine.SalesUnit) will yield 'Unit: [Unit.UnitId], [Unit.Txt]'. Mine reads 'Unit: Each, Each'.

Assuming you don't want to see this. There is an override on the form's field (actually at the field level) called 'toolTip'. Definition: Tooltip (also known as intotip) – a common graphical user interface element which is used in conjunction with a cursor, usually a mouse pointer. http://en.wikipedia.org/wiki/Tooltip

This method's super() returns a string that is formed by grabbing the table relation title fields discussed earlier. All that is needed is to replace the string that is returned from the super and there you have it! Using the strFmt('%1, %2...'), variable1, variable2, ...));, function, you can put any number of variables in here to display. I have not seen a limit... But too much would look dumb so I'd try to keep it to no more than 4.