attachmentHandler/snattachmentHandler doesn't work in scoped Applications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2020 11:13 PM
Hi All,
I trying to replicate the ticket attachment widget for one of scoped application portal. I could see that attachmentHandlers is being used on OOB ticket attachment widget, when I tried the same on my scoped application widgets, it doesn't seem to work.
Need help to figure out why it isn't working or any workaround for it. Any help is much appreciated. Here is my code,
HTML:
<span class="file-upload-input">
<input type="file" style="display: none" name="grFile" id="grFile" multiple="true" ng-file-select="attachFile($files,$event)" class="sp-attachments-input">
<button ng-click="attachmentGRC($event)" type="button" class="btn btn-default send-message">${Add Attachment}</button>
</span>
Client script:
$scope.attachmentGR = function($event) {
$event.stopPropagation();
var $el = $element.find('input[id=grFile]');
$el.click();
}
$scope.attachFile = function(file,$event)
{
var e = $event.currentTarget;
if (e)
e.value = '';
snAttachmentHandler.create('sn_grc_issue', $scope.data._attachmentGUID).uploadAttachment(file[0]).then(function(response) {
snAttachmentHandler.renameAttachment(response.sys_id, fName).then(function(response) {
var nah = $scope.attachmentHandler = new nowAttachmentHandler(setAttachments, function() {});
nah.setParams('sn_grc_issue', $scope.data._attachmentGUID, 1024 * 1024 * 24 /*24MB*/);
function setAttachments(attachments, action)
{
$scope.attachments = attachments;
$scope.data.attachmentList = attachments;
console.log("attchlist0 = "+attachments)
}
$scope.attachmentHandler.getAttachmentList();
});
});
};
var ah = $scope.attachmentHandler = new nowAttachmentHandler(setAttachments, function() {});
ah.setParams('sn_grc_issue', $scope.data._attachmentGUID, 1024 * 1024 * 24 /*24MB*/);
// console.log("current target = " + fName);
function setAttachments(attachments, action)
{
$scope.attachments = attachments;
$scope.data.attachmentList = attachments;
console.log("attchlist = "+attachments)
}
$scope.attachmentHandler.getAttachmentList();
}
Thanks,
Murali Pasikanti
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2020 11:16 PM
Hi Murali,
on which form you are trying to perform this?
what is your exact requirement here?
Did you try using OOB attachment paper clip icon for your requirement
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader