Number of Attachments Indicator in Dynamics AX 2012
I have been asked by a couple of customers to add a number indicator on the attachments button in AX 2012. The idea being when a user opens a form, like the sales order form, they can look at the number on the attachments button and tell right away if there are any attachments on the sales order. This is very similar to a cue but you cannot use a cue on a button so you have to find a different way to do it. Here is what I did on the SalesQuotationTable form.
1. On the form you want to modify, in the active method on the datasource, change the text on the button to something like:
Attachments.text(int642str(SalesQuotationTable.getNumOfAttachments()) + "\n" + "@SYS316708");
2. Create the method: getNumOfAttachments on the SalesQuotationTable or datasource on the form.
display int64 getNumOfAttachments()
where docuRef.RefCompanyId == this.DataAreaId
&& docuRef.RefTableId == this.tableId
&& docuRef.RefRecId == this.RecId;