How to add an attachment functionality in a service portal page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 12:06 AM
I have this page to record data and I want to add an attachment functionality where users can add attachment in service portal.
Do you have an idea how to do it?
Please advise.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 03:02 AM
Thanks for this Sir
Ill check on it.
Best regards,
Joan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2019 11:19 PM
Hi Joanmarisse,
i need to create an attachment in my custom portal .
Could you please help me on this , if you achieved this.
regards,
Manmath
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 03:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2019 04:23 AM
Hi Hardik,
After much headache getting file(s) to be passed from client to server side (worked 50% of the time) for using rest call in server script, I came across your widget which does the same client side, without the transient existance issue of the file(s).
I've used your widget with some modification, but the problem I have is that in order to get the file(s) to write through the rest call, I have to pass basic authentication credentials for a user with rest permissions. When doing so, this then logs in to the portal with this user, something I want to avoid. Any thoughts on how to get around this?
$scope.uploadFiles = function() {
$scope.fd = new FormData();
$scope.files.forEach(function(file){
$scope.fd.set('files', file);
var request = {
method: 'POST',
url: 'https://<instancename>.service-now.com/api/now/attachment/file?table_name=new_call&table_sys_id='+c.data.sys_id+'&file_name='+file.name,
data: $scope.fd.get('files'),
headers: {
'Content-Type': file.type,
'Accept':'application/json',
'Authorization': 'Basic <base64 encrypted username and password>'
}
};
console.log('HTTP request:',request);
// SEND THE FILES.
$http(request)
.success(function (d) {
// On success code here
})
.error(function (err) {
// On error code here
});
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2019 11:44 AM
Not sure. I believe passing authorization in header is mandatory for this: https://docs.servicenow.com/integrate/inbound_rest/reference/r_AttachmentAPI-POST.html