# Combining \<MacroConfig\> with storage

**URL:** <https://community.developer.atlassian.com/t/combining-macroconfig-with-storage/66190>\
**Category:** Forge\
**Tags:** dynamic-content-macro, forge-storage\
**Created:** [February 9, 2023, 5:20am UTC](https://community.developer.atlassian.com/t/combining-macroconfig-with-storage/66190 "2023-02-09T05:20:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottohara](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/scottohara/32/52316_2.png) [@scottohara](https://community.developer.atlassian.com/u/scottohara)\
**Post date:** [February 9, 2023, 5:20am UTC](https://community.developer.atlassian.com/t/combining-macroconfig-with-storage/66190/1 "2023-02-09T05:20:31Z")

</div>

In Forge, we can add configuration to a dynamic content macro by including a `config` key in the manifest, and using the `<MacroConfig>` UI kit component to specify the configuration UI, which will display in a side panel when editing the macro.

As with Connect and P2 macros, any parameter values specified in this config UI are stored with the page content and trivially accessible by end users (e.g. View Source and View Storage Format).

```javascript
import ForgeUI, { MacroConfig, TextField, render } from '@forge/ui';

const Config = () => {
  return (
    <MacroConfig>
      <TextField name="notsecret" label="This is not a secret"/>
      <TextField name="secret" label="This is a secret"/>
    </MacroConfig>
  );
}

export const run = render(<Config />);

```

In the above example, the storage format for a page that includes this macro might include something like this:

```xml
<ac:adf-parameter key="notsecret">Hello</ac:adf-parameter>
<ac:adf-parameter key="secret">Shhh!</ac:adf-parameter>

```

Because of this, Atlassian’s guidance is: don’t store sensitive information in macro parameters.  
Instead use Forge storage, and in particular the `storage.getSecret()` and `storage.setSecret()` APIs.

In an ideal world, the UI kit designers might have considered this guidance and provided developers with a simple way to indicate that a particular macro parameter value should be stored in storage vs page content, e.g. hypothetically something like a `storage` attribute:

```xml
<MacroConfig>
  <TextField name="notsecret" label="This is not a secret"/>
  <TextField name="secret" label="This is a secret" storage="true"/>
</MacroConfig>

```

…and the UI kit component could automatically take care of securely storing the value and associating it with the correct instance of the macro.

From what I can tell, nothing like this actually exists.

Developers that wish to offer macro configuration that includes potentially sensitive values are left to solve this themselves.

Equally, `<MacroConfig>` doesn’t seem to have an `onSubmit` event or similar that could be used to to intercept the values and handle this storage ourselves.

Are there any examples of how such a thing might be achieved using UI kit?  
If not, is it possible to build a macro config UI with Custom UI?  
Has anyone else solved this, or a similar issue, before?

---

<div class="post-metadata">

**Author:** ![scottohara](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/scottohara/32/52316_2.png) [@scottohara](https://community.developer.atlassian.com/u/scottohara)\
**Post date:** [February 9, 2023, 10:57pm UTC](https://community.developer.atlassian.com/t/combining-macroconfig-with-storage/66190/2 "2023-02-09T22:57:46Z")

</div>

Potentially answering my own question here:

> Is it possible to build a macro config UI with Custom UI?

I found this post from 2021:

> [@How to use Macro Configuration with Custom UI apps in Forge](https://community.developer.atlassian.com/t/how-to-use-macro-configuration-with-custom-ui-apps-in-forge/46242/7):
>
> Actually, the main idea is to add macro configuration to an existing custom ui macro. The plan is to use the data received from the configuration to filter the data in the custom ui macro. So I want to do exactly this [https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro/](https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro/) but with custom ui macro. Correct me if I am wrong but at the moment, I noticed that I can only achieve this solution when I use UI kit macro. This was the reason behind my first question of transferring c…

In it, it seems to indicate that macro configs can only be build using UI Kit:

> [@How to use Macro Configuration with Custom UI apps in Forge](https://community.developer.atlassian.com/t/how-to-use-macro-configuration-with-custom-ui-apps-in-forge/46242/12):
>
> The config must be defined using UI kit. It is not possible to use custom UI for macro config.

…and that there are no callbacks on UI Kit components:

> [@How to use Macro Configuration with Custom UI apps in Forge](https://community.developer.atlassian.com/t/how-to-use-macro-configuration-with-custom-ui-apps-in-forge/46242/19):
>
> It would be ideal if the Select widget had an onChanged callback so I could plumb that into the api call

Is this still the case, 18 months later?

---

<div class="post-metadata">

**Author:** ![SilvreLestang](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/silvrelestang/32/46501_2.png) [@SilvreLestang](https://community.developer.atlassian.com/u/SilvreLestang)\
**Post date:** [February 10, 2023, 8:33am UTC](https://community.developer.atlassian.com/t/combining-macroconfig-with-storage/66190/3 "2023-02-10T08:33:15Z")

</div>

Yes, it is still the case. Please add yet another vote to the issue, so this might understand that it is very important: [[FRGE-513] - Ecosystem Jira](https://ecosystem.atlassian.net/browse/FRGE-513)

This ticket might help you by the way: [[FRGE-416] - Ecosystem Jira](https://ecosystem.atlassian.net/browse/FRGE-416)
