web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to check and display whether a file/files is getting attached to a record in HCMWorker table or not?

(0) ShareShare
ReportReport
Posted on by

Hello

I am running a X++ class. When I run it all the files present in a particular folder at a place are getting attached to the record in HcmWorker table which want.

Now I want the file attached/ not attached status to be displayed in the Excel file. I know how to create Excel file, but how to know whether the file is really attached to the particular record in HcmWorker table or not using DocuRef table?

Manually if I go to a particular record and check it is getting attached. But how to achieve the same using X++ code and Docuref table.

Also I am attaching different types of files like jpeg,.txt,.doc.csv and so on.

Please give some idea.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    DocuRef (table) >> IsValueAttached (method) should help you

    as you will go to attach a document manually in ax you will see a checkbox at end named as "Attched", which represents if document has been attached or not.

  • Verified answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Hi Mahesh,

    When you attached any document with a record in AX table, file path gets stored in DocuValue table. If you see Documenation of DocuValue Table it tells you that. As Sohaib suggested have a look on IsValueAttached() method of DocuRef Table.

    You can also have a look at \Forms\DocuView\Methods\loadFile method at line # 14. it first checks either document is attached with the record or not.

  • Community Member Profile Picture
    on at

    Okay Sohaib and Faisal. I checked it. Sohaib I am attaching files via X++ code.

    I have a folder in which few files are there like for example

    a.txt b.txt c.pdf d.doc

    suppose c.pdf doesn't gets attached from the folder then it is showing infolog that this type of file doesn't gets attached.

    Now I want this unattached file's status to be written to an Excel file using X++.

    Now suppose that c.pdf is already attached to the hcmrecord say 557 IN THE PREVIOUS RUN.

    And in this run this this file doesn't gets attached.

    Next assume that this file was tried to attached from same path then how can I check?

    Can you people tell more clearly indetail?

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    any table can be linked to DocuRef with following

    RefComapnyId

    RefTableId

    ReRecId

    now for your any table lets suppose HCMWorker, if you want to know that which documents are attached to the record of hscmworker, you can reach  DocuRef  using above three fields.

    next from DocuRef you can use method IsValueAttached  of DocuRef (TABLE) to know if there is attachment with record.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans