Skip to main content
Question

Custom Widget problem

  • December 5, 2025
  • 0 replies
  • 0 views

Tommas
Apprentice

Hi,

I’ve created a feedback widget.
I’ve added the related code to the footer connecting a button with a JS listener and it’s correctly opening a ticket.
I’ve tried to pre-fill the most of the filed ( native and custom ) following the documentation:
https://developers.freshdesk.com/widget-api/
But the filed are not auto filled.

I’m sharing the code, could you please confirm that the structure in correct ( we can asume that the maping is correct ) : 

<script>
  window.fwSettings = {
    'widget_id': 103000008811
  };
  !function(){if("function"!=typeof window.FreshworksWidget){var n=function(){n.q.push(arguments)};n.q=[],window.FreshworksWidget=n}}();
</script>
<script type='text/javascript' src='https://euc-widget.freshworks.com/widgets/103000008811.js' async defer></script>

<script>
  document.getElementById('feedback-btn').addEventListener('click', function() {
    FreshworksWidget('on', 'widget:loaded', function() {
      FreshworksWidget('prefill', 'ticketForm', {
        source: 9,
        priority: 1,
        status: 2,
        type: 'Question',
        group_id: 103000018370,
        custom_fields: {
          cf_option653248: 'OTHER',
          cf_seller: '1MONDE9 (984)',
          cf_sourcing_country: 'France',
          cf_shop: 'Andre (VP_FR - 38491)',
          cf_platform: 'Other',
          cf_topic: 'Process',
          cf_web: 'Severals',
          cf_resolution_by_department: 'Other',
          cf_requesting_team: 'Other',
        }
      });

      FreshworksWidget('hide', 'ticketForm', [
        'source',
        'custom_fields.cf_web',
        'custom_fields.cf_requesting_team',
      ]);

      FreshworksWidget('open', 'ticketForm');
    });
  });
</script>