Client.interface.trigger stops working after navigating between tickets (no error)

Hello Freshdesk team,

I’m experiencing an issue with the client.interface.trigger("setValue", ...) method inside a custom Freshdesk app.

:puzzle_piece: Problem Description

When I access a ticket for the first time after a page refresh, calling client.interface.trigger correctly sets a custom field (with ID cf_rfrence_de_contrat).

However, if I:

  1. Navigate back to the list of tickets (e.g., via breadcrumb or sidebar),
  2. Then select a different ticket,

The same client.interface.trigger function silently fails to update the field — no error is thrown, and the onSuccess callback is still called, but the field value is not updated in the UI.


:repeat_button: Reproducible Steps

  1. Refresh the Freshdesk page.
  2. Open a ticket → client.interface.trigger works.
  3. Navigate back to the ticket list.
  4. Open another ticket.
  5. Trigger the same function → nothing happens in the UI (no error either).

:package: Code Example

Here is the relevant snippet:

export const updateTicket = async (
  client: FreshdeskClient,
  subscription_id: string,
  onSuccess?: (id: string) => void
) => {
  try {
    await client.interface.trigger("setValue", {
      id: "cf_rfrence_de_contrat",
      value: subscription_id,
    });

    if (onSuccess) {
      onSuccess(subscription_id);
    }
  } catch (error) {
    console.error("Erreur lors de la mise à jour du ticket:", error);
  }
};

This function is called when clicking a button inside a React component.


:white_check_mark: Expected Behavior

client.interface.trigger("setValue", ...) should work consistently every time the ticket details page is active — even after navigating from another ticket.


:red_question_mark: What I’ve Tried

  • Verified that client is still valid.
  • Checked that onSuccess runs (it does).
  • Looked for errors in the console (none).
  • Logging confirms the call happens, but the UI does not update.

:magnifying_glass_tilted_left: Environment

  • Custom App using FDK v9.3.1
  • React 18 (rendered via ReactDOM.render for compatibility)
  • Field ID: cf_rfrence_de_contrat

Please let me know if there’s a lifecycle or app context issue I should handle differently when navigating between tickets without a full reload.

Thanks in advance!

This issue typically stems from how the FDK client lifecycle manages host-to-iframe communication across Freshdesk’s internal SPA routing.

When an agent navigates between tickets in the workspace, the host page doesn’t always perform a clean teardown of your app iframe; instead, it emits the app.activated event with the updated ticket context. If your code captures the client instance or attaches listeners strictly inside app.initialized, the communication channel port can become detached after consecutive route changes, resulting in silent drops.

A few recommendations to resolve this:

  1. Re-bind handlers on app.activated: Ensure that any state or DOM watchers that trigger interface updates are re-established inside client.events.on('app.activated', ...) rather than relying exclusively on app.initialized.
  2. Check for form hydration race conditions: Sometimes setValue is invoked before the newly routed ticket details form has finished mounting in the parent DOM. Awaiting a quick data check like await client.data.get('ticket') prior to triggering the interface action ensures the host container is fully ready to receive values.
  3. Explicit error handling: Wrap the trigger call in an async try/catch or chain .catch(), as some interface errors fail asynchronously without surfacing to global error handlers:
try {
  const result = await client.interface.trigger("setValue", { id: "priority", value: 1 });
  console.log("Interface update successful", result);
} catch (error) {
  console.error("Interface trigger error:", error);
}