# Grab the file url(s) using automations

**URL:** <https://community.fibery.io/t/grab-the-file-url-s-using-automations/10910>\
**Category:** Get Help\
**Created:** [May 25, 2026, 1:39pm UTC](https://community.fibery.io/t/grab-the-file-url-s-using-automations/10910 "2026-05-25T13:39:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bear](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/bear/32/12872_2.png) [@bear](https://community.fibery.io/u/bear)\
**Post date:** [May 25, 2026, 1:39pm UTC](https://community.fibery.io/t/grab-the-file-url-s-using-automations/10910/1 "2026-05-25T13:39:45Z")

</div>

I am trying to get the Url of a file in the File field, but it does not seem to get it. Is this data not accessible via automations or am I doing something wrong?

```auto
const fibery = context.getService('fibery');
const utils = context.getService('utils');

const ids = args.currentEntities.map(e => e.id);
if (ids.length === 0) {
    return 'No entities selected';
}

// Retrieve File field for all selected entities in one call
const entities = await fibery.getEntitiesByIds('Breakfast at TIFFanys/TIFFs', ids, ['File']);

const urls = [];
for (const ent of entities) {
    const fileField = ent['File'];
    if (!fileField) {
        continue;
    }
    // The File field may be a single file object or a collection; handle both cases
    const files = Array.isArray(fileField) ? fileField : [fileField];
    for (const f of files) {
        if (f && f.Secret) {
            urls.push(utils.getFileUrl(f.Secret));
        }
    }
}

if (urls.length === 0) {
    return 'No file URLs found';
}

return `File URLs:\n${urls.join('\n')}`;

```

---

<div class="post-metadata">

**Author:** ![bear](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/bear/32/12872_2.png) [@bear](https://community.fibery.io/u/bear)\
**Post date:** [May 25, 2026, 2:00pm UTC](https://community.fibery.io/t/grab-the-file-url-s-using-automations/10910/2 "2026-05-25T14:00:31Z")

</div>

I found the solution already:

```auto
const fibery = context.getService('fibery');

const ids = args.currentEntities.map(e => e.id);
if (ids.length === 0) {
    return 'No entities selected';
}

const entities = await fibery.getEntitiesByIds(
    'Breakfast at TIFFanys/TIFFs',
    ids,
    ['Apples']
);

const lines = [];

for (const ent of entities) {
    const apples = ent['Apples'] || [];
    for (const f of apples) {
        if (!f || !f['Id']) continue;
        const fileInfo = await fibery.getEntityById('fibery/file', f['Id'], ['Secret']);
        if (!fileInfo || !fileInfo['Secret']) continue;
        lines.push(`${f['Name']}: https://therightplace.fibery.io/api/files/${fileInfo['Secret']}`);
    }
}

if (lines.length === 0) {
    return 'No files found in Apples';
}

return lines.join('\n');

```

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 26, 2026, 5:31am UTC](https://community.fibery.io/t/grab-the-file-url-s-using-automations/10910/3 "2026-05-26T05:31:19Z")

</div>


