Consider using the path on the DocuRef table.
select obj_docuRef
where obj_docuRef.RefRecId == objAttachment.RecId;
info(obj_docuRef.path());
Question
how to get a filename attached to a record in AX 2012... e.g., I have some table named table1 in which I have attached a file with each record.
Now, i want to write a job to fetch the name of files attached to a particular record in a table.
I got it working as
static void CheckAttacheddocu(Args _args)
{
Dev_Attachment objAttachment;
DocuRef obj_docuRef;
;
select objAttachment
where objAttachment.AttachmentId == "001";
select obj_docuRef
where obj_docuRef.RefRecId == objAttachment.RecId;
info(obj_docuRef.Name);
}