如何在Zendesk中仅针对Bugs/Errors表单预填工单描述?
解决Zendesk工单表单切换时动态预填描述字段的问题
方案1:使用用户脚本(Tampermonkey/Greasemonkey)实现动态填充
因为无法修改Zendesk底层代码,用户脚本是最直接的浏览器端解决方案,能监听页面元素变化并执行自定义逻辑:
- 安装Tampermonkey(Chrome、Firefox等主流浏览器均支持)扩展
- 点击Tampermonkey图标,选择「创建新脚本」
- 替换默认代码为以下内容:
// ==UserScript== // @name Zendesk Bug Form Auto-Fill Description // @namespace http://tampermonkey.net/ // @version 0.1 // @description Auto-fill description when selecting Bugs/Errors form, clear when selecting others // @match https://XXX.zendesk.com/hc/en-us/requests/new* // @grant none // ==/UserScript== (function() { 'use strict'; // 预设的Bug工单描述模板 const BUG_DESCRIPTION = `1. What did you do? (Include steps to reproduce the issue) 2. What did you actually get? 3. What did you expect? 4. What is the reproduction rate? (X out of Y tries) 5. Other information: Platform (Mobile / Web): Version: Browser: User ID: User Email: Phone OS (Android / iOS): Phone OS Version (e.g. iOS 16.4): Phone Model: (e.g. Samsung S23 Ultra): Time: `; // Bugs/Errors表单的ID const BUG_FORM_ID = '8038396746255'; // 获取表单选择下拉框和描述输入框 const formSelector = document.querySelector('select[name="ticket_form_id"]'); const descriptionField = document.querySelector('textarea[name="description"]') || document.querySelector('#request_description'); // 定义填充/清空描述的函数 function updateDescription() { if (formSelector.value === BUG_FORM_ID) { descriptionField.value = BUG_DESCRIPTION; } else { descriptionField.value = ''; } } // 页面加载时初始化,监听表单选择变化 if (formSelector && descriptionField) { updateDescription(); formSelector.addEventListener('change', updateDescription); } })();
- 修改脚本中的
@match字段为你的Zendesk工单页面地址,确认BUG_FORM_ID和元素选择器与实际页面匹配 - 保存脚本后,打开Zendesk工单页面测试:切换到Bugs/Errors表单时描述自动填充,切换到其他表单则清空
方案2:通过引导页面分流跳转
如果是从自有平台引导用户提交工单,可做一个简单的选择页面:
- 页面放置两个按钮:「提交Bug/错误」和「提交需求/改进」
- 点击「提交Bug/错误」时,跳转到你已创建的预填URL
- 点击「提交需求/改进」时,跳转到不带
tf_description参数的工单URL(格式为https://XXX.zendesk.com/hc/en-us/requests/new?ticket_form_id=【需求表单ID】)
这种方式无需依赖用户脚本,完全由你控制跳转逻辑,适合自有用户的工单引导场景
内容的提问来源于stack exchange,提问作者Leon
相关产品推荐
相关产品推荐

