Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Forge Macro in Page Properties Report

Mohammad Zaman February 23, 2024

Hello, 

I have Page Properties Report macros set up to display a list of pages. Within these pages, I've integrated custom macros developed with Forge and UI Kit.

A single Standalone page: Macros work fine (first 4 rows) 

standalone-page.png

 

Errors:


As you saw above, the macros work fine in any standalone page, but displays error in the Page Properties  Report (see the image below). 

PagePropertiesReport.png


There are 3 things happening in the image above.

1.The first error occurred in the 'Test CreatedBy' column, where the 'we don't have a way to export this macro' error was encountered due to the usage of UI Kit 2. Interestingly, the macro works fine and displays the value 'Hello World (UI Kit 2)' on standalone pages.

2.The second issue arises with errors in the TestCreationDate and TestLastModifiedDate columns, both utilizing Forge macros with UI Kit. While these macros function correctly on standalone pages, they fail to display properly within the Page Properties Report.

I've developed three separate components in three different JSX files and specified them in the manifest.yml file. To insert these macros into pages, I use a forward slash followed by the macro name or title. This allows the page to display the values generated by these macros.


.jsx_files.pngmanifest.png


3.  This is an interesting discovery: none of the approaches worked within the Page Properties Report Macro except for this specific method. By copying the code from creationDate.jsx and pasting it into the index.jsx file, the macro successfully displays values both on standalone pages and within the Page Properties Report Macro..

Question:

1. how do I fix the first error if i want to use UI kit2 ? 

 

2 & 3) Why is it that creating multiple macros in JSX and defining them in the manifest.yml file as macro doesn't function properly within the Page Properties Report Macro, but does work when solely defined in index.jsx?

Do I have to create a separate forge app with source code in index.jsx, and then  deploy  and install them? 

If i completely remove main: index.js from package.json and keep the other file , i get a package_json.png
different error: We've Encountered an issue exporting this macro. Please Try exporting this page again later.

 

Thanks in advanced. 

 

2 answers

0 votes
Yuwei Shen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 19, 2025

Hey @Mohammad Zaman@Wolfgang L 

From the screenshot of the manifest you provided, I noticed you're using the old UI Kit (1) `function` param - updating it to the manifest structure of UI Kit (2) may help - ignore if you've migrated already. See the snippet below or the docs.

I've just tested with a new UI Kit (2) app and I'm able to render the macro successfully in the page properties report. However, I did use a very simple setup - what version of `@forge/react` are you using?

This is what I see with a UI Kit (2) app:
Screenshot 2025-03-20 at 4.35.07 PM.png

 

Why is it that creating multiple macros in JSX and defining them in the manifest.yml file as macro doesn't function properly within the Page Properties Report Macro, but does work when solely defined in index.jsx?

Do I have to create a separate forge app with source code in index.jsx, and then  deploy  and install them? 

Hm this should work, with multiple macro modules your manifest should follow something like this:

modules:
macro:
- key: macro-key
resource: main
render: native
resolver:
function: resolver
title: My macro
- key: second-macro-key
resource: second-resource
render: native
resolver:
function: resolver
title: My second macro
function:
- key: resolver
handler: index.handler
resources:
- key: main
path: src/first-macro/frontend/index.jsx
- key: second-resource
path: src/second-macro/frontend/index.jsx
app:
id: "<your app id>"

 

If updating the app to the latest version of `@forge/react` doesn't work, can you send the contents of index.jsx and creationDate.jsx? 

I will also ask the engineers behind page properties report about this.

Thanks for your patience,

Yuwei

0 votes
Wolfgang L
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 5, 2024

@Mohammad Zaman

I just wanted to let you know that I am facing the same problem. 

Migrated an custom macro to UI Kit 2 (now UI Kit) and it worked fine on the individual pages. But breaks on the page properties report.

Any updates from Atlassian on this?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events