How to write the script for attached the file in workspace in popup window in sow workspace
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I want to write the workspace client script ( pop up window ) for upload new version behavior it is just like the attachment functionalities as shown in screen shot in sow workspace . Could you please help me on this.
11 REPLIES 11
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @vaishali231
I added the alert in the code , only the first alert is working rest are not execute,
function onClick(g_form) {
alert("test1");
var modal = new nowModal({
title: 'Import a Word File',
size: 'md'
});
alert("test2" +modal);
modal.render(`
<div style="padding:16px">
<input type="file" id="ws_file" accept=".doc,.docx" />
<br><br>
<button class="btn btn-primary" onclick="uploadNewVersion()">Import</button>
</div>
`);
window.uploadNewVersion = function () {
var fileInput = document.getElementById('ws_file');
alert("test3 window function" +modal);
if (!fileInput || !fileInput.files.length) {
alert('Please select a file');
return;
}
var file = fileInput.files[0];
alert("test4 window function" +modal);
var attachmentHandler = new nowAttachmentHandler({
tableName: g_form.getTableName(),
tableSysId: g_form.getUniqueValue()
});
attachmentHandler.uploadAttachment(file).then(function () {
alert("test5 window function" +modal);
modal.close();
g_form.refresh();
});
};
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
see if maybe of any help
How to open a UI Page in a popup window (GlideModa... - ServiceNow Community
