我一直在努力让它工作一段时间。我有一个通过 GlideDialog 包含 UI 页面的 UI 操作。UI 页面只是一个包含一堆输入(文本类型)和一个文件类型的表单。单击提交按钮后,我将通过 glideAjax 发送表单数据和文件附件,
var issueObj = {};
var ga = new GlideAjax(glideAjax);
var name = $j_jb('#name').val();
var address = $j_jb('#address').val();
var file = $j_jb('#jira_attachment')[0].files[0];
issueObj.name = name;
issueObj.address = address;
var IssueObjString = JSON.stringify(issueObj);
ga.addParam('sysparm_name','createIssue');
ga.addParam('sysparm_issueObj', IssueObjString);
ga.addParam('sysparm_attachment', file);
var that = this;
ga.getXML(function (response) {
var responseStatus = response.responseXML.documentElement.getAttribute("answer");
var DOMData = "";
if(responseStatus) {
that.displayMessage(jiraAlert['success-insertion']);
}
else {
that.displayMessage(jiraAlert['error-insertion']);
}
});
我有相应的脚本包含它在这里调用的方法,
createIssue: function() {
var issueObj = this.getParameter("sysparm_issueObj");
var fileAttachment = this.getParameter("sysparm_attachment");
issueObj = JSON.parse(issueObj);
var fileName = issueObj.fileAttachment.name;
var fileType = issueObj.fileAttachment.type;*/
var gr = new GlideRecord('sample_table');
gr.newRecord();
gr.name = issueObj.name;
gr.address = issueObj.address;
insertRef = gr.insert();
var ga = new GlideSysAttachment();
ga.write(gr, fileAttachment.name, fileAttachment.type, fileAttachment);
}
附件生成的记录已损坏,
我在这里碰壁了,不知道如何进一步进行。非常感谢这方面的任何帮助!
谢谢,
拉斯基尔