# How i can get an id of attached docuement?

**URL:** <https://community.ofelia.com/t/how-i-can-get-an-id-of-attached-docuement/7613>\
**Category:** Q&A\
**Created:** [18 July 2016 16:04 UTC](https://community.ofelia.com/t/how-i-can-get-an-id-of-attached-docuement/7613 "2016-07-18T16:04:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![claz08](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@claz08](https://community.ofelia.com/u/claz08)\
**Post date:** [18 July 2016 16:04 UTC](https://community.ofelia.com/t/how-i-can-get-an-id-of-attached-docuement/7613/1 "2016-07-18T16:04:15Z")

</div>

Hi,

When a user attached a document, automatically the file data will be registred into database with an unique id, so how i can retrieve this unique id?

Many thanks!!.

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [19 July 2016 02:47 UTC](https://community.ofelia.com/t/how-i-can-get-an-id-of-attached-docuement/7613/2 "2016-07-19T02:47:15Z")

</div>

`
apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "mainDoc").getId();
`

from [http://documentation.bonitasoft.com/documents-0](http://documentation.bonitasoft.com/documents-0)

also see

[http://documentation.bonitasoft.com/handling-documents-0](http://documentation.bonitasoft.com/handling-documents-0)

regards  
Seán

_PS: If this reply answers your question, please mark as resolved._

---

<div class="post-metadata">

**Author:** ![claz08](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@claz08](https://community.ofelia.com/u/claz08)\
**Post date:** [19 July 2016 14:00 UTC](https://community.ofelia.com/t/how-i-can-get-an-id-of-attached-docuement/7613/3 "2016-07-19T14:00:24Z")

</div>

Thanks Sean!!

really helped me !

Do you know , if is possible to move the attached file to some other path?

Thanks again!!

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [19 July 2016 20:16 UTC](https://community.ofelia.com/t/how-i-can-get-an-id-of-attached-docuement/7613/4 "2016-07-19T20:16:52Z")

</div>

See

[http://community.ofelia.com/questions-and-answers/how-i-can-move-file-has-been-attached-widget](http://community.ofelia.com/questions-and-answers/how-i-can-move-file-has-been-attached-widget)

Also please mark this question as resolved (Click the tick next to my answer), as it has, the other question will fix your other issue.

regards  
Seán
