Adding attachment in service portal User profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 05:45 AM
Need to add attachment in user profile page in service portal.
Where the attachment should be displayed in users profile.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 10:24 PM
Add the ticket attachment widget to user profile page in your portal.
For example please find below the OOB ticket page with incident form URL.
OOB Page id : ticket
OOB Attachment wideget : Ticket Attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2019 12:11 AM
Hi Akhil,
The below link not opening and showing nelow error
please suggest.
And as i am new to here, could you please help me with code, so that i can achieve this.
Since 1 week i am trying to achieve this but could not get any proper answer from our community.
Please help.
Regards,
manmath

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2019 07:36 PM
Please find the below code which will attach your files in the backend (you can check the sys_attachment table).
HTML -
<div>
Select File : <sp-attachment-button></sp-attachment-button>
</div>
Client Script -
function($scope, $http, spScUtil, spUtil, nowAttachmentHandler, $rootScope, $sanitize, $window, $sce, i18n, $timeout, $log, spAriaUtil, $document, spModal) {
/* widget controller */
var c = this;
$scope.stickyHeaderTop = '0px';
$scope.$on('dialog.upload_too_large.show', function(e){
$log.error($scope.m.largeAttachmentMsg);
spUtil.addErrorMessage($scope.m.largeAttachmentMsg);
});
$scope.m = $scope.data.msgs;
var ah = $scope.attachmentHandler = new nowAttachmentHandler(setAttachments, appendError);
function appendError(error) {
spUtil.addErrorMessage(error.msg + error.fileName);
}
ah.setParams($scope.data._attachmentTable, $scope.data.recordID, 1024 * 1024 * $scope.data.maxAttachmentSize);
function setAttachments(attachments, action) {
$scope.attachments = attachments;
if (action === "added")
{
console.log("added");
c.server.update();
}
if (action === "renamed"){
console.log("remaned");
spAriaUtil.sendLiveMessage($scope.m.renameSuccessMsg);
c.server.update();
}
if (action === "deleted"){
console.log("deleted");
spAriaUtil.sendLiveMessage($scope.m.deleteSuccessMsg);
c.server.update();
}
}
$scope.attachmentHandler.getAttachmentList();
$scope.confirmDeleteAttachment = function(attachment, $event) {
$rootScope.$broadcast("dialog.delete_attachment.show", {
parms: {
ok: function() {
$scope.attachmentHandler.deleteAttachment(attachment);
$rootScope.$broadcast("dialog.delete_attachment.close");
},
cancel: function() {
$rootScope.$broadcast("dialog.delete_attachment.close");
},
details: attachment.name
}
})
}
$timeout(function() {
if ($document[0].getElementsByClassName('sc-sticky-item-header').length > 0) {
var titleHeight = $document[0].getElementsByClassName('sc-sticky-item-header')[0].clientHeight;
$scope.stickyHeaderTop = '-' + (titleHeight - 20 - $document[0].getElementsByClassName('sc-cat-item-short-description')[0].clientHeight) + 'px;';
}
});
$scope.$on('sp_loading_indicator', function(e, value) {
$scope.loadingIndicator = value;
});
}
Server Script -
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data._attachmentTable = "sc_req_item";//here put your table
data.recordID = "46d91e8bdb800010feeb47823996190d";// this sys_id is of my instance, put your record or req sys_id so that it will be seen in REQ as well
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2019 02:47 AM
Hi akhil kumar,
I tried with your code <sp-attachment-button></sp-attachment-button>
it doesnt open any window, to upload a file