CRM action components callback?

Hi there!

Anybody know if there is a way to call a function (callback) after a user use a CRM action components?

The use case is to refresh a Card (for an App) after the user performs an Action link (for instance, associating or creating a deal with a company, for instance)

It will also be nice if they could support other child components inside like <Icon> so we can render icons inside the button. Regular <Button> component supports Icons inside.

How is the best way to let developers know?

Hi @dgomez-dev,
Thank you for posting to the Community!
I’d like to tag in our Top Contributors to see if they have any ideas if this is possible -- Hi @WesQ @ChrisoKlepke and @mangelet Do any of you know if this is possible? If not, do you have any workarounds?
In terms of feedback, I would highly recommend to post feature request to our Ideas Forum here. This is the best way to ensure your suggestion is seen by our product team and allows other Community members to support and discuss your idea, helping us prioritize the most impactful improvements for HubSpot.
Cassie, Community Manager

CRM action components don’t natively support callbacks, but there’s a workaround pattern I’ve used in production apps: use the serverless function that handles your action to emit a custom event, then listen for that event in your Card component.

Here’s the flow:
1. In your CRM action’s serverless function (the one that creates/associates records), after the HubSpot API call completes, send a message back to the iframe using `window.parent.postMessage()` with a custom event type.

2. In your Card component, add a `useEffect` hook that listens for `message` events from the parent window. Filter for your custom event type and trigger a state refresh when received.

3. Alternatively, if you’re using the UI Extensions SDK, you can leverage `context.actions.refreshObjectProperties()` after the action completes to force the card to re-fetch data.

The postMessage approach is more flexible since it works across iframe boundaries and doesn’t rely on the card’s default refresh behavior. Just make sure to validate message origins to prevent XSS.

Regarding icons in action buttons—that’s currently not supported in the UI schema. I’d +1 that feature request in the Ideas Forum. The workaround is using emoji in button text, but it’s not ideal for professional UIs.

Jumping in with a small clarification on top of @amjadkhatri great explanation: the window.parent.postMessage() call can’t run from a serverless function, since serverless code doesn’t have access to window or the DOM. Instead, the serverless function should just perform the create/associate work and return to your front-end; then, in the browser context (the iframe that rendered the CRM action), you’d call window.parent.postMessage(...) once the action succeeds and listen for that in your card via window.addEventListener('message', ...) to trigger your refresh.
The overall pattern Muhammad described (no native callback, using a custom event via postMessage, validating origins, and the note about icons not being supported in action buttons today) is absolutely the right direction — this is just a tweak about where that postMessage can safely live.

Best, Victor