Fixing Connect AP.confluence.getMacroBody for dynamic content macro with plain-text body type

What is changing?
Within the Fabric Editor in preview mode, a dynamic content macro with the plain-text body type will be updated with a new body value.
Related API: Confluence

Why is it changing?
It was a bug. AP.confluence. saveMacro was saving body value but in preview mode macro was not getting updated with the new macro body.

What do I need to do?
Developers can now use AP.confluence.getMacroBody in their app to get updated body values. Make sure the app is plain-text body type.

By when do I need to do it?
The bug fix is available for members of the developer first release cohort

6 Likes

Hi @TapanParikh Thank you for the update. This is really fantastic news.
We have been waiting for a fix since 2019. As they say, better late than never.

I did a quick check and AP.confluence.getMacroBody function indeed seems to work (i.e it returns the expected latest version). Do you have any timeline when it will be released to all customers?

Glad to hear that fix worked for you.

We plan to roll out to all customers on 2021-11-08T08:00:00Z

@TapanParikh Great news. Has this fix been applied to both getMacroBody() and getMacroData() ?

Thanks for reaching out to us.
Current fix is for getMacroBody() for plain-text body type.
Related to getMacroData() is fixed as part of [CONFCLOUD-70639] Calling getMacroData returns stale results - Create and track feature requests for Atlassian products..
Let me know if still have any questions.

1 Like

I find this a confusing response…

You say that the getMacroData() is fixed as part of [CONFCLOUD-70639] Calling getMacroData returns stale results - Create and track feature requests for Atlassian products., but that ticket actually mentions in the last comment (by you) that it was fixed as part of [CONFCLOUD-69962] Connect JS AP.getMacroBody does not work in Preview Mode - Create and track feature requests for Atlassian products., which I assume is the ticket you are discussion in the OP?

Sorry for the confusion.

The first iteration of the fix for [CONFCLOUD-69962] Connect JS AP.getMacroBody does not work in Preview Mode - Create and track feature requests for Atlassian products. actually fixed the getMacroData() and closed ticket [CONFCLOUD-70639] Calling getMacroData returns stale results - Create and track feature requests for Atlassian products. with comments. The second(current topic) iteration of fix for CONFCLOUD-69962 will fix the getMacroBody() for plain-text body type.

To clear the confusion getMacroData() is fixed and getMacroBody() for plain-text body type is fixed.

Hope that clears your confusion.

1 Like

Have you tried this with Macro Editor?
Unless I need to wait for “the release”… currently it does not seem to work

May be related to the bug where calling to

AP.confluence.saveMacro(macroParams, macroBody); 

does not save macro body

Thanks for reaching out to us.
Yes, I tried with dynamic macro with plain-text body type with macro editor.
Currently, we have rolled to developer first release cohort. Planning to roll out in prod from Oct 25th in incrementing phases.

Hi, I’m not entirely sure if this is related but it seems like AP.confluence.getMacroData() has stopped working inside a custom macro editor on the same date this fix starts rolling out.

What I can observe is that it only happens inside a custom editor, i.e. calling AP.confluence.getMacroBody() on the exact same dynamic content macro:

  • returns the macro data correctly in page view and in preview.
  • returns empty string inside the custom macro editor.

Is this a bug introduced with this fix? Because I couldn’t find any other recent changes on AP.confluence.getMacroBody().

Edit: My original post says getMacroData() whereas I meant getMacroBody(), my mistake.

5 Likes

Hi @TapanParikh , looks like there is an issue with plain text macro: when I edit the page, the content of it is empty:


Would you please have a look?
Thanks!

1 Like

Hello, thanks for reaching out to us.

I tried with the macro editor, it seems to be working fine. Below I have a screen recording, where I am able to update the previous parameter value. I use the below function on the editor to fetch the param value

function readData() {
        AP.confluence.getMacroData(function (macroParameters) { 
        document.getElementById("text-val").value = macroParameters.param1 
        }
    );

This is what are you trying to achieve?

Hello, thanks for reaching out to us.

Can you give more context on the issue you face?

If you send me the steps to reproduce, would be very helpful.

Hi,

I’m sorry, I meant getMacroBody() not getMacroData(), I got the two names confused in my original post, sorry for the confusion.

As of current, getMacroBody() still return empty string inside a custom macro editor, althought once in a while I see the macro body loaded properly but almost 99% of the time it returns empty string and I only observed it inside a custom macro editor thus far. Any clue if it’s related?

5 Likes

Hi @TapanParikh ,
Please the video here:

1 Like

I can confirm that this has stopped working. We have a private discussion, @TapanParikh, with the demo I have recorded and it was working OK for the plain-text macros (never worked for rich-text)
But now it does not work for the plain-text body macros anymore

3 Likes

(post deleted by author)

The phenomenon pointed out by toshihiro occurs in various macros.
Today I updated a lot of content on Confluence, but the content represented by the macro has been cleared.
I am in great trouble, so I would like you to resolve it as soon as possible.

1 Like

Confirmed the same thing for us

Hello all, sorry for the issue.
I confirm there is an ongoing issue with the macro editor, we are working on fixing that issue. I Will update once it is fixed.