We created multiple forge macros to facilitate repeated content tasks.
Similar to what is explained here add-configuration-to-a-macro-with-ui-kit, we are adding configurations to our macros.
For content rendered by forge macros to export (PDF, WORD and word exporter for confluence) and match the Front-end content we implemented a adfExport.
When launching an export request to word or pdf, our adfExport export function is indeed called which is great. It is invoked one or multiple times per page (depending on number of macro instances on each pages) which is expected.
However, we are struggling to implement conditions that require configurations parameters values .
For instance, referring to the Pet sample where the “age” parameter is easily retrieved in the Front-End using useConfig(). In the Back-end adfExport exporting function, we are struggling to understand the full context of the invocations, namely what is the macro configuration (parameters key and their values) that we need to resolve to render the content.
In the “Pet” sample and to illustrate we need to render the “age” value for instance.
The context we receive looks like this:
“context”: {
“localId”: “…”
“cloudId”: “…”
“moduleKey”: “”
“siteUrl”: “< atlassian base URL>”
},
“exportType”: “pdf”
So how are we supposed to resolve the following? Is it possible with the context we receive?
-The “age” parameter value for instance that we need to print,
-The macro instance or macro-ID (the macro instance that is being printed since there could be many on the page and we get called multiple times).
-The content ID or page-Id being exported.
-The content version
If not currently possible, can we request to add more information to the context so we can render based on macro specific instances and configuration?