Forge Macro Export release

We’re excited to announce that the Forge export macro is available for Developer First Rollouts. We’ve started releasing for general availability. You are more than welcome to share your feedback, report bugs or ask questions.

For more information on the export function, see the Macro documentation.

6 Likes

Good to hear that this is getting addressed.

However can the documentation be improved and/or can we get a proper example project (like these) of how this new export property is supposed to be used?
I tried to add this to some of our custom UI macros to test it but I just cannot seem to get it to work when converting the page with the macro via /rest/api/contentbody/convert/export_view.

Prior to changing anything the output of the macro is We don't have a way to export this macro, which is expected. When I add a new function and wire that into the export property it changes to an error instead:

Unexpected error in app
An error occurred while trying to load this app

There is nothing in the logs that would allow me to determine what is going wrong. And the logs I have in my export function aren’t showing there or in the tunnel output either, which makes me think the export function is never even called and this error is happening before even getting to my code.

For reference, from the vague documentation I assumed the function specified in the export property is just a plain function with a string return value, so this is how I had set up my testing:

# manifest.yml
modules:
  macro:
    - key: my-macro
      title: Some macro
      resource: my-macro-res
      export:
        function: my-export-function

  function:
    - key: my-export-function
      handler: export-macro.exportMacro
# ... rest of the manifest with resources, etc..


// export-macro.ts
export function exportMacro(): string {
   console.log('Macro export view');
   return '<p>Foo</p>';
}
2 Likes

Hi @thomas2, export function can only be UI kit. Same UI kit components can be used for implementing it.

Hi @EnginTekin , when can we expect export for Custom UI?

Hi @marc, export function is supported for Custom UI macros too.

@EnginTekin Thanks for the clarification.

As @thomas2 posted, I think the export function is not being (properly) invoked.
I created a macro from scratch using the UI Kit, added the export module, the function, and included a basic text fragment together with a console log to check when the export function is invoked, but nothing happened.
I get the Unexpected error in app: An error occurred while trying to load this app. error too.
Will file a ticket for this.

Hi @PatricioBiggeri , could you share the ticket when you create it?

Yes, it is DEVHELP-15154.

Thanks for creating the issue @PatricioBiggeri. Looks like it was an error on our side, should be fixed now.

Thanks! It works now. But…

I’m facing a new issue which is that at the export time it is not able to retrieve the config of the macro and returns an error because it is undefined: TypeError: Cannot read property '....' of undefined

Should we be able to get the config of the macro for export? Is the page history tracking the changes in the config of the macro as part of the versioning?

Thanks!

Should we be able to get the config of the macro for export? Is the page history tracking the changes in the config of the macro as part of the versioning?

Yes. Macro config should be available as part of export. We’re aware of this issue and will work on it soon, here I created a ticket for it if you like to subscribe.

Is the page history tracking the changes in the config of the macro as part of the versioning?

It should, because macro config is saved as part of page.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.