D365FO – Get number of attachments with document using X++

 


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;
}

Comments