how to add multiple attachment button to portal for catalog item

J_31
Kilo Sage

how to add multiple attachment button to portal for catalog item

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @J_31 

 

What is business need here?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Amit Verma
Kilo Patron
Kilo Patron

Hi @J_31 

 

You can have multiple attachment fields on the catalog item instead of the button. Please refer to below snip where I have added multiple attachment variables.

 

AmitVerma_0-1704783331222.png

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

cloudops
Tera Expert


To add multiple attachment buttons to a portal for a catalog item in ServiceNow, you can follow these steps:

1. Navigate to the Service Portal Configuration.
2. Click on Designer.
3. Select the page where you want to add the multiple attachment button.
4. Drag and drop the "Multiple File Attachments" widget to the desired location on the page.
5. Save the changes.

Please note that the "Multiple File Attachments" widget is available out-of-the-box in ServiceNow and it allows users to upload multiple files at once.

Also, keep in mind that the maximum number of attachments and the maximum size of each attachment are controlled by system properties. You can adjust these properties if needed.

Here is a sample code snippet for adding a multiple attachment button:

javascript
spModal.open({
title: 'Attach a file',
widgetId: 'widget-attachment-upload',
widgetInput: {
table: 'incident',
sys_id: c.data.sys_id,
redirect: $location.url()
},
size: 'lg',
buttons: [
{label:'Done', cancel:true}
]
});

cloudops
Tera Expert

To add multiple attachment buttons to a portal for a catalog item in ServiceNow, you can follow these steps:

1. Navigate to the Service Portal Configuration page.
2. Click on the Designer.
3. Select the page where you want to add the multiple attachment button.
4. Drag and drop the "Multiple File Upload" widget to the desired location on the page.
5. Save the changes.

Please note that the "Multiple File Upload" widget allows users to upload multiple files at once. If you want to add multiple buttons for different purposes, you may need to create custom widgets or modify the existing one.

Here is a sample code for a custom widget:

javascript
// Client Script
function($scope, $http) {
$scope.files = [];
$scope.upload = function() {
var fd = new FormData();
angular.forEach($scope.files, function(file) {
fd.append('file', file);
});
$http.post('/api/now/attachment/file', fd, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
})
.success(function(){
// success code
})
.error(function(){
// error code
});
};
}