In the widget, transfer the file obtained from the client to the server
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 06:03 PM - edited 01-22-2025 06:07 PM
Hello
I created a widget, the screen operation I uploaded a file.
And get the file in client. I want to transfer the currently obtained file to the server side for processing.
Client:
entryVal[1] is a file
Server:Now the Server gets empty(fileData)
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 07:52 PM
please share your both the scripts and not screenshots
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 08:19 PM
Client:
c.uploadAttachments2 = function() {
document.getElementById('fileToUpload').value = '';
$scope.files.forEach(function(file) {
$scope.fd = new FormData();
$scope.fd.append('files', file);
var fdEntries = $scope.fd.entries();
var fdEntry = fdEntries.next();
var entryVal = fdEntry.value;
c.server.get({
action: 'uploadFileServer',
caData: {
fileData: entryVal[1]
}
}).then(function(r) {
});
};
Server:
if (input) {
if (input.action == "uploadFileServer") {
gs.info('xuexu0123===' + input.caData.fileData);
}
}
log:
xuexu0123===[object Object]
Once the Server gets the file, I want to call the AttachmentAPI and upload the file