Issues with File Upload Functionality in Custom ServiceNow Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 10:39 PM
Hello Community,
I'm currently developing a custom widget in ServiceNow to render a UI for managing qualifications. The widget needs to display a list of qualifications and allow users to upload evidence files (either `.txt` or `.pdf`). I've structured my widget with AngularJS, incorporating ng-repeat for dynamic content generation and utilizing AngularJS's file input for uploads.
I'm encountering issues with the file upload functionality. Specifically, the file upload buttons triggers the expected file selection dialog, but the logic to handle file selection and display the selected file name is not working as intended.
Here's a brief overview of my setup:
- JSON data model for qualifications.
- HTML template for the widget, using `ng-repeat` for dynamic row generation and `ng-if` for conditional display.
- Client script that includes functions to show/hide additional fields, handle file selection, and remove selected files.
I've made sure to include `ng-change` and `onFileSelected` function to process file selection but it seems to not recognize file inputs correctly or update the model accordingly.
Could anyone provide insight into what might be going wrong or suggest a more effective approach to handle file uploads within a custom ServiceNow widget? Below are snippets of my JSON structure, HTML template, and client script related to the file upload functionality.
I suspect the issue might be related to how I'm binding file inputs within `ng-repeat` or possibly missing steps in the file selection handling process. Any advice, code examples, or resources on best practices for implementing file uploads in ServiceNow widgets would be greatly appreciated.
Thank you in advance for your help!