Number of Attachments Indicator in Dynamics AX 2012

By Becky Newell | March 7, 2014

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()

{

DocuRef docuRef;

select count(RecId)

from docuRef

where docuRef.RefCompanyId == this.DataAreaId

&& docuRef.RefTableId == this.tableId

&& docuRef.RefRecId == this.RecId;

return docuRef.RecId;

}

Related Posts

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!