How to Categorize Tickets by Customer Portal Language in BoldDesk
Organizations that support customers in multiple languages may need to categorize and route tickets to agents based on the language selected in the Customer Portal. This can help support teams filter, manage, and assign tickets more efficiently when different teams handle different languages.
By creating a custom dropdown ticket field and using Customer Portal custom JavaScript, you can automatically capture the portal locale when a ticket is submitted. Agents can then use the field in Advanced Filters, reports, and custom ticket views to identify and manage tickets by language.
This approach classifies tickets based on the Customer Portal language selected when the ticket form is opened. It does not detect or analyze the language used in the ticket subject, description, or subsequent conversations.
How the Workaround Works
The following table outlines how the workaround captures the selected Customer Portal language and stores it on the ticket for filtering and reporting purposes:
| Stage | Description |
|---|---|
| Customer opens the Customer Portal | The Customer Portal URL includes a locale code, such as en-US or uk, indicating the selected portal language. |
| Customer opens the ticket form | The custom JavaScript reads the locale code from the Customer Portal URL. |
| Language field is populated | The script maps the locale code to the corresponding option in the custom dropdown field and automatically sets the field value. |
| Customer submits the ticket | The selected language value is saved as part of the ticket. |
| Agent filters tickets | Agents can use the custom language field in Advanced Filters, reports, or saved Ticket Views to identify and manage tickets by language. |
Prerequisites
Before configuring this workaround, ensure the following requirements are met:
- Enable the required languages in the Customer Portal.
- Create a custom dropdown ticket field to store the ticket language.
- Make the custom field visible on the Customer Portal ticket form.
- Obtain the custom field’s API name.
- Obtain the option ID associated with each language value.
- Verify that the Customer Portal URL includes the applicable locale code.
For detailed instructions on creating and managing custom fields, see BoldDesk Fields and Forms: Custom Fields, Display, and Dependencies.
Create the Custom Ticket Language Field
Create a custom Dropdown ticket field with a descriptive name, such as Ticket Language. Add a dropdown option for each Customer Portal language that you want to track.
For example:
| Language | Example Option ID |
|---|---|
en-US |
898 |
uk |
899 |
The option IDs shown above are examples only and will differ between BoldDesk accounts. Use the option IDs configured in your own ticket field settings.
The custom field will be used to store the Customer Portal language selected when the ticket is submitted, allowing agents to filter, report on, and create ticket views based on language.
Configure the field so that:
- The field is visible on the Customer Portal ticket form.
- Customers can submit the populated value.
- Agents can view the value on the ticket.
- The field is available in Advanced Filters.
Record the field’s API name. For example:
cf_ticket_language
Add Custom JavaScript to Capture the Customer Portal Language
To automatically populate the custom language field based on the language selected in the Customer Portal, add custom JavaScript that reads the locale code from the portal URL and maps it to the corresponding dropdown option.
- Navigate to Admin > Customer Portal > Customization > Custom JS.
- Add the following script:
(function () {
const languageOptionByLocale = {
"en-US": 402,
"uk": 403
};
const intervalId = setInterval(() => {
const locale = window.location.pathname.split("/")[1];
const languageControl =
document.querySelector(".cf_ticket_language .e-control")
?.ej2_instances?.[0];
const optionId = languageOptionByLocale[locale];
if (!languageControl || !optionId) {
return;
}
languageControl.value = optionId;
languageControl.dataBind();
clearInterval(intervalId);
}, 1000);
})();
- Replace the example values with the values from your BoldDesk account.
| Example Value | Replace With |
|---|---|
.cf_ticket_language |
The CSS class generated from the API name of your custom ticket field |
en-US |
The locale code used for English in your Customer Portal URL |
uk |
The locale code used for Ukrainian in your Customer Portal URL |
402 |
The dropdown option ID associated with the English language value |
403 |
The dropdown option ID associated with the Ukrainian language value |
For more information about Customer Portal customization, see BoldDesk Customer Portal Customization.
Do not use the example field name, locale codes, or option IDs without verifying the values in your own BoldDesk account. Custom field API names and dropdown option IDs vary between accounts.
Add Additional Languages
If your Customer Portal supports multiple languages, add each locale code and its corresponding dropdown option ID to the languageOptionByLocale object.
For example:
const languageOptionByLocale = {
"en-US": 402,
"uk": 403,
"de": 404,
"fr": 405
};
Use only locale codes that appear in your Customer Portal URLs and option IDs configured in the custom language field.
Avoid using a simple two-value condition such as the following in portals that support more than two languages:
locale === "en-US" ? 402 : 403
This approach assigns the same option ID to every locale other than en-US, which can result in incorrect language classification. Instead, use an explicit locale-to-option mapping to ensure each supported language is mapped to the correct dropdown option.
Test the Language Field Population
After configuring the custom field and JavaScript, verify that the language value is populated correctly for each supported Customer Portal language.
- Open the Customer Portal using the English locale.
- Open the ticket creation form.
- Verify that the Ticket Language field is automatically set to the English language value.
- Submit a test ticket.
- Open the ticket in the Agent Portal and confirm that the correct language value was saved.
- Repeat the test using the Ukrainian locale.
- Verify that the Ticket Language field is automatically populated with the Ukrainian language value.
- Test any additional supported locales and confirm that each locale maps to the correct dropdown option.
- Verify that unsupported locales do not populate the field with an incorrect language value.
Expected Result
When a requester opens the ticket form, the custom JavaScript reads the locale from the Customer Portal URL and automatically populates the Ticket Language field with the corresponding value. After the ticket is submitted, agents can use the field in Advanced Filters, reports, and Ticket Views to identify and manage tickets by language.
Create Language-Based Ticket Views
After the custom field is populated, create an Advanced Filter using the Ticket Language field.
Create a View for English Tickets
Use the following filter:
Ticket Language → Is → en-US
Create a View for Ukrainian Tickets
Use the following filter:
Ticket Language → Is → uk
Save each filter as a Ticket View so that the applicable support team can reuse it.
For complete instructions, explore more on How to Apply Advanced Filters and Save Views in BoldDesk.
Limitations
This workaround does not:
- Automatically redirect a customer to the preferred Customer Portal language.
- Read the preferred language stored in the customer’s profile.
- Update the customer’s profile language.
- Detect the language of the ticket subject or description.
- Populate tickets created through email.
- Populate tickets created through the Agent Portal.
- Populate tickets created through the REST API.
- Populate tickets created through another channel.
The stored field value represents the Customer Portal locale used when the ticket form was opened.
- A customer can select one Customer Portal language and write the ticket in another language. The custom field, therefore, identifies the selected portal locale, not necessarily the written language of the request.
- Customer Portal Custom JavaScript can depend on the current page structure and control rendering.
- Test the customization after Customer Portal theme, form, custom field, or product updates.
Troubleshoot the Workaround
| Problem | Possible Cause | Resolution |
|---|---|---|
| Language field remains empty | The field selector does not match the custom field’s API name. | Confirm the field API name and update .cf_language. |
| Wrong language is assigned | The locale mapping contains an incorrect option ID. | Compare each locale code with the option IDs in the ticket-field configuration. |
| Every non-English locale becomes Ukrainian | A two-value conditional expression is being used. | Replace the conditional expression with an explicit locale mapping object. |
| Field is populated but not saved | The field is not properly configured for the Customer Portal or the control value was not applied before submission. | Review the field’s Customer Portal configuration and test the form again. |
| Email-created tickets have no language value | Customer Portal JavaScript does not run for email-created tickets. | Populate the field through another supported manual or integration workflow. |
| Language field is unavailable in Advanced Filters | The field is inactive or is not configured as an available ticket custom field. | Confirm that the field is active and available for the applicable ticket form. |
| Script stops working after a portal update | The page structure or rendered field control changed. | Review the current portal markup, update the field selector, and retest the customization. |
| Unsupported locale remains unassigned | The locale does not exist in languageOptionByLocale. |
Add the locale and its corresponding option ID to the mapping. |
Frequently Asked Questions
-
Does This Workaround Detect the Language of the Ticket?
No. The script reads the locale code from the Customer Portal URL. It does not analyze the ticket subject or description. -
Does the Workaround Set the Customer’s Preferred Language?
No. The workaround sets a custom field on the submitted ticket. It does not read or update the language stored in the customer’s profile. -
Does the Workaround Redirect Customers Automatically?
No. Automatic Customer Portal language redirection is not provided by this workaround.
Customers must select an enabled language or open the applicable language-specific Customer Portal URL. -
Can the Field Be Used in Ticket Views?
Yes. After the custom field is populated, use it in an Advanced Filter and save the filter as a Ticket View. -
Does the Workaround Apply to Email-Created Tickets?
No. Customer Portal Custom JavaScript runs only on Customer Portal pages.
Use another supported manual or integration workflow when language classification is required for tickets created through email or another channel. -
What Happens When the Portal Uses an Unmapped Language?
The custom field remains unchanged because the script cannot find a corresponding option ID.
Add the locale and its correct option ID tolanguageOptionByLocalewhen the language must be classified. -
Can Customers Change the Populated Language Field?
This depends on the custom field’s Customer Portal configuration.
If customers should not change the automatically populated value, configure the field according to the available field visibility and editing options, then test the ticket form before publishing the customization.