Parse the CSV file upload in ServiceNow Service Portal

Body HTML template   <div class=”text-center m”> <span class=”file-upload-input”> <input type=”file” style=”display: none” multiple=”true” ng-file-select=”attachmentHandler.onFileSelect($files); filePicked($files);” class=”sp-attachments-input”> <button title=”Add attachment” ng-click=”attachmentHandler.openSelector($event)” class=”btn btn-primary sp-attachment-add” aria-label=”Add attachment” role=”button”>${Upload the custim file} </button> </span> </div> Client Controller Code $scope.filePicked = function (oEvent) { docArr = []; // Get The File From The Input var oFile = oEvent[0]; […]

Avoid duplicate attachments in ServiceNow

This can be achieved by creating a before business rule on the sys_attachment table. If there is a file with same name, same content type and of same size in bytes then the attachment upload is aborted. The code for the same is as below (function executeRule(current, previous /*null when async*/) { var attach = […]