Recent searches
No recent searches

Gosia
Joined Dec 19, 2024
·
Last activity Jan 07, 2025
Following
0
Followers
0
Total activity
3
Votes
0
Subscription
1
ACTIVITY OVERVIEW
BADGES
ARTICLES
POSTS
COMMUNITY COMMENTS
ARTICLE COMMENTS
ACTIVITY OVERVIEW
Latest activity by Gosia
Gosia commented,
Hi James and Jennifer,
Thank you both for your suggestions! Let me clarify a few points and share what I’ve tried so far.
-
Static Values Testing:
Yes, I’ve tested with static values directly in the script. For example:javascript
Code kopieren
{ "fields": [ { "id": "name", "prefill": { "*": "John Doe" } }, { "id": "email", "prefill": { "*": "john.doe@example.com" } } ] }
Despite this, only the first name ("John") appears in the ticket, and custom fields are not populated.
-
Dynamic PHP Values:
- I’ve confirmed that the PHP variables (e.g.,
$name
,$email
,$goal
) are correctly set and return valid values. -
Using
console.log()
in the browser, I verified that theZendeskSettings
object includes all the expected values:json
Code kopieren
{ "name": "John Doe", "email": "john.doe@example.com", "custom_field_1": "Sample Value", "custom_field_2": "Another Value" }
The values are being passed correctly to the widget.
- I’ve confirmed that the PHP variables (e.g.,
-
Field IDs and Configuration:
- I’ve double-checked that the custom field IDs in the script match exactly with those in Zendesk Admin.
- The custom fields are configured as editable for customers in the Admin settings.
-
JavaScript Execution:
- The JavaScript code runs without errors. The widget initializes correctly, and the prefill values appear in the
ZendeskSettings
object as expected. - I’ve also tested different placement of the widget initialization script to ensure timing isn’t an issue.
- The JavaScript code runs without errors. The widget initializes correctly, and the prefill values appear in the
-
API and Permissions:
- The API key has the necessary permissions to create tickets and manage prefill data. At least I can add prefill fields in the admin panel
-
Behavior in Tickets:
- When I view the submitted tickets in Zendesk Admin, the following is observed:
- Only the first name appears (e.g., "John"), and no custom field data is included.
- When I view the submitted tickets in Zendesk Admin, the following is observed:
Next Steps:
I’m wondering if there’s a specific limitation with the Web Widget that might explain this behavior or if I’m missing something subtle in the setup.
Thank you for your help, and I appreciate any additional insights!
View comment · Posted Jan 07, 2025 · Gosia
0
Followers
0
Votes
0
Comments
Gosia created a post,
Hi Community,
I’m having trouble with dynamically prefilled custom fields in the Zendesk web widget. Despite following the documentation, the fields remain empty in the API request and do not appear in the created ticket.
Steps I’ve taken:
- Created custom fields in the Zendesk Admin settings. The fields are configured as "Customer can edit."
-
Used the following script to prefill fields dynamically using PHP variables:
html
Code kopieren
-
Tested the setup. The widget appears correctly, but the dynamically prefilled values are not transmitted. For example:
-
name
andemail
do not appear anywhere in the ticket. - The custom field with ID
15119319576476
is shown in the API request but has anull
value.
-
The issue:
The generated API request looks like this:
json
Code kopieren
{
"request": {
"url": "https://MY_DOMAIN_BY_ZENDESK/api/v2/requests/104336.json",
"id": 104336,
"status": "new",
"priority": null,
"type": null,
"subject": "test",
"description": "test\n\n------------------\n",
"organization_id": null,
"via": {
"channel": "web",
"source": {
"from": {},
"to": {},
"rel": "web_widget"
}
},
"custom_fields": [
{ "id": 15119319576476, "value": null }
],
"fields": [
{ "id": 15119319576476, "value": null }
]
}
}
My question:
- Are there known limitations with dynamically prefilling fields in the web widget?
- Do we need to handle dynamic variables differently to ensure they are transmitted properly to Zendesk tickets?
- Has anyone successfully implemented dynamic prefill for custom fields in the web widget?
Any help or insight would be greatly appreciated. Thank you in advance!
Posted Dec 19, 2024 · Gosia
0
Followers
3
Votes
3
Comments