# How to invoke data for adfExport in Confluence Forge UI Kit?

**URL:** <https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890>\
**Category:** Forge\
**Tags:** forge-change-the-confluence-frontend-with-the-ui-kit, dac-get-help\
**Created:** [November 5, 2024, 1:32pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890 "2024-11-05T13:32:02Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 5, 2024, 1:32pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/1 "2024-11-05T13:32:02Z")

</div>

I have the next problem. I’m exporting page with macro (only table from UI Kit). In pdf it’s clear but in Word I have notification that it’s impossible to export this macro.

In [this tutorial](https://developer.atlassian.com/platform/forge/change-the-confluence-frontend-with-the-ui-kit/#specify-the-export-view) I found how to use adfExport Function to export macro in Atlassian document format.

But I still didn’t find the next main points:

1. How to get Config for this macro (because all necessary data for export stores in this config)?
2. How to invoke my resolver function to get data from Back-end? (Example use only Confluence API, but not application backend)?

---

<div class="post-metadata">

**Author:** ![AaronCollier](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@AaronCollier](https://community.developer.atlassian.com/u/AaronCollier)\
**Post date:** [November 6, 2024, 9:07am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/2 "2024-11-06T09:07:16Z")

</div>

For config, [this tutorial](https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro-with-ui-kit/) might help.

To reach your app’s backend, you likely want the [`invoke` method](https://developer.atlassian.com/platform/forge/apis-reference/ui-api-bridge/invoke/#invoke).

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 6, 2024, 7:46pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/3 "2024-11-06T19:46:47Z")

</div>

Config stores in `context.extension.config` and adfExport function has only this fields in context:

```auto
{
    "context": {
        "accountId": "string",
        "cloudId": "string",
        "contentId": "",
        "extensionContext": {
            "type": "macro"
        },
        "extensionData": {
            "content": {
                "id": ""
            },
            "isConfig": false,
            "space": {
                "key": ""
            },
            "type": ""
        },
        "isConfig": false,
        "localId": "",
        "moduleKey": "",
        "spaceKey": ""
    },
    "exportType": "word",
    "contextToken": ""
}

```

To invoke method I need properties for filtering data from config but I don’t know how I can have an access to this config from adfExport function ☹

[This tutorial](https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro-with-ui-kit/) is for **UI Kit** , **not for back-end function** such as adfExport function!

---

<div class="post-metadata">

**Author:** ![AaronCollier](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@AaronCollier](https://community.developer.atlassian.com/u/AaronCollier)\
**Post date:** [November 6, 2024, 8:53pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/4 "2024-11-06T20:53:01Z")

</div>

Sorry for the too quick response. I see now that the export functions are only for UI Kit 1, not a supported version of the UI Kit. The original tutorial isn’t up-to-date. (The naming convention doesn’t help.)

It seems like there was a [recent change](https://community.developer.atlassian.com/t/retrieving-macro-configuration-parameters-during-export-in-forge-macros/83370/4) to allow config to be accessed for PDF export, but it seems they didn’t extend that to Word. @JakeStrauss might know more.

For the backend, is it a remote backend? If so, I’d use [Forge remote](https://developer.atlassian.com/platform/forge/remote/#forge-remote).

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 7, 2024, 6:07pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/5 "2024-11-07T18:07:15Z")

</div>

It seems that now it is impossible to export Forge UI Kit application in Word, only in PDF (Native PDF export works well).

OK, let’s wait for decision from the Atlassian side.

---

<div class="post-metadata">

**Author:** ![SamLeatherdale](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/samleatherdale/32/51863_2.png) [@SamLeatherdale](https://community.developer.atlassian.com/u/SamLeatherdale)\
**Post date:** [November 8, 2024, 12:47am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/6 "2024-11-08T00:47:20Z")

</div>

Hello @IgorKosarev

I am an Atlassian engineer currently working on the macros experience.

I wanted to find out more about the issues you are running into, and propose some solutions.

Firstly, with `config`, it is accessible on the top level payload that is provided, not as a child of `context`:

```javascript
export const adfExportFunction = async (payload) => {
  const config = payload.config;
}

```

Secondly, for sharing logic between your resolver function and your export function, you don’t need to call the resolver itself, instead, you could just call a shared function that you use in your resolver.

There may be differences in the properties provided in the context, so check any properties you need are available in both `context` from the resolver and the export function.

```javascript
function sharedLogic(context) {
  console.log(context)
}

const resolver = new Resolver();
resolver.define("getText", (req) => {
  sharedLogic(req.context)
})
export const handler = resolver.getDefinitions();

export const adfExportFunction = async (payload) => {
  sharedLogic(payload.context)
}

```

Finally, for the Word export issue, I have not been able to reproduce this on my side, I am successfully able to export Custom UI and UI Kit 2 macros to Word.

Can you perhaps share some more details about the issue that you are running into, and also share the macro definition from your `manifest.yml` file?

Thanks!

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 8, 2024, 7:22am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/7 "2024-11-08T07:22:04Z")

</div>

Hi, @SamLeatherdale

OK, I got the first and second point.

When I export to Word from Forge app (UI Kit 2) I have the next result:

 ![Screenshot 2024-11-08 at 09.13.24](https://global.discourse-cdn.com/atlassiandeveloper/original/3X/3/c/3c6b93d4ac0342a1b827d101fec257663cd04a9e.png)

> We don’t have a way to export this macro.

It happens if I don’t use adfExportFunction.

My `manifest.yml` now is:

```auto
macro:
    - key: my-app-key-macro
      resource: page-macro
      render: native
      resolver:
        function: resolver
      title: Title
      config: true
      icon: resource:resources;icons/main_logo.svg

```

It works perfectly for PDF but doesn’t work for Word export.

I have tried to use `adfExportFunction` (I added it into `manifest.yml` and it works with “Hello word” paragraph) but I didn’t understand how to get data from macro config (settings from the right macro editing panel in UI). I can get data from my back-end functions without resolver but I need data from macro config.

---

<div class="post-metadata">

**Author:** ![SamLeatherdale](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/samleatherdale/32/51863_2.png) [@SamLeatherdale](https://community.developer.atlassian.com/u/SamLeatherdale)\
**Post date:** [November 8, 2024, 7:42am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/8 "2024-11-08T07:42:50Z")

</div>

Hi @IgorKosarev

I can’t see the `adfExport` defined in your `manifest.yml`

To properly use the ADF export feature, you must define it in your manifest, like so:

```yml
macro:
  - key: my-app-key-macro
    adfExport: 
      function: adf-export-function 
    # other macro properties
function:
  - key: adf-export-function
    handler: exportFile.adfExportFunction

```

Then, in your ADF export function, you will be able to access the config via `payload.config`, as demonstrated above:

```javascript
export const adfExportFunction = async (payload) => {
  const config = payload.config;
}

```

This should work for PDF and for Word.

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 8, 2024, 6:19pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/9 "2024-11-08T18:19:16Z")

</div>

Hi @SamLeatherdale

OK, I use this payload like this:

```auto
import { doc, p } from '@atlaskit/adf-utils/builders';

export const adfExportFunction = async (payload) => {
    const config = payload.config;
    
    return doc(
        p(`Config: ${config}`),
        p(`Payload: ${JSON.stringify(payload)}`)
      );
  }

```

I’ll get the next result:

 ![Screenshot 2024-11-08 at 20.14.39](https://global.discourse-cdn.com/atlassiandeveloper/original/3X/c/f/cfd399238d1c110c5edaa9045027b8e6b4a95968.png)

As you can see there are no `config` data 😢  
It is my question: “How I can get config data?”

My `manifest.yml` is:

```auto
macro:
    - key: my-app-for-confluence-macro
      resource: page-macro
      render: native
      resolver:
        function: resolver
      title: App title
      config: true
      icon: resource:resources;icons/logo.svg
      adfExport: 
        function: adf-export-function 

```

---

<div class="post-metadata">

**Author:** ![SamLeatherdale](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/samleatherdale/32/51863_2.png) [@SamLeatherdale](https://community.developer.atlassian.com/u/SamLeatherdale)\
**Post date:** [November 11, 2024, 12:27am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/10 "2024-11-11T00:27:06Z")

</div>

Hi @IgorKosarev

I am able to see the `config` object in my test export:

 ![image](https://global.discourse-cdn.com/atlassiandeveloper/original/3X/8/6/86f3406afc0823858a8424b9518a0c4249124447.png)

Can I confirm that you are:

1. Adding config to your macro using `ForgeReconciler.addConfig` as described [in the docs](https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro-with-ui-kit/)?
2. Clicking the edit button on the macro and setting some config properties in the right-hand sidebar, then publishing the page, before attempting to export it?

Even if you have added config to your macro from the code side, you need to actually populate each macro you insert into a page with config values for them to appear in the export.

If this doesn’t solve the issue for you, then I would have to suggest raising a support ticket with [Developer and marketplace support](https://developer.atlassian.com/support) so they can undertake more detailed troubleshooting with you.

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 11, 2024, 5:20am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/11 "2024-11-11T05:20:55Z")

</div>

Hi @SamLeatherdale

It was the problem from number 2. Config didn’t specify in the right-hand sidebar (a lot of experiments with it and I forgot to confit it when I was trying to export for now).

Now I get the config in my adfExport function.

Thank you!

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [November 14, 2024, 7:33pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/12 "2024-11-14T19:33:10Z")

</div>

Hi @SamLeatherdale

It is an another problem with config.

For PDF and for Word export it has absolutely different location in payload:

 ![Screenshot 2024-11-14 at 21.28.11](https://global.discourse-cdn.com/atlassiandeveloper/original/3X/f/0/f0cfe77d387cf0c08a516be8063fa65b6d965bbf.png)

The problems:

1. Different locations for `config` object
2. If confit attribute is a string with not latin characters there is “???” in this attribute for this characters for Word export.

Is it expected behavior for adfExport Function or is it a bug?

---

<div class="post-metadata">

**Author:** ![SamLeatherdale](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/samleatherdale/32/51863_2.png) [@SamLeatherdale](https://community.developer.atlassian.com/u/SamLeatherdale)\
**Post date:** [November 15, 2024, 1:11am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/13 "2024-11-15T01:11:26Z")

</div>

Hi @IgorKosarev

These are definitely bugs and are not expected.

I have gone ahead and raised two public bugs that you can follow for updates:

- [[FRGE-1582] Unicode characters broken in macro config for Word adfExport](https://ecosystem.atlassian.net/browse/FRGE-1582)
- [[FRGE-1583] Payload shape inconsistent between PDF and Word macro ADF Export](https://ecosystem.atlassian.net/browse/FRGE-1583)

Thank you for reporting these issues.

---

<div class="post-metadata">

**Author:** ![IgorKosarev](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/igorkosarev/32/50832_2.png) [@IgorKosarev](https://community.developer.atlassian.com/u/IgorKosarev)\
**Post date:** [December 7, 2024, 3:44pm UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/14 "2024-12-07T15:44:26Z")

</div>

@SamLeatherdale, hi!

But I still can’t invoke my resolvers functions from adfExport.

I have data in the [Storage](https://developer.atlassian.com/platform/forge/runtime-reference/storage-api/) and I can’t reach my data via resolver function with `invoke` or directly via `storage.entity()`.

There are no any logs into developer console in browser and no logs into developer console on developer portal.

I only receive this in Word export:

> We’ve encountered an issue exporting this macro. Please try exporting this page again later.

Is it possible to get data from Storage in adfExport?

---

<div class="post-metadata">

**Author:** ![SumitParakh](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@SumitParakh](https://community.developer.atlassian.com/u/SumitParakh)\
**Post date:** [January 12, 2026, 8:47am UTC](https://community.developer.atlassian.com/t/how-to-invoke-data-for-adfexport-in-confluence-forge-ui-kit/85890/15 "2026-01-12T08:47:16Z")

</div>

Is there any way to invoke our remote backend for adfExport? We couldn’t find any documentation around defining remote endpoint for adfExport and interested to know if there are any workaround to that?
