- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 12:38 AM
Hi Team ,
I need to check if attachment is atached to the form then Alert box should appear with attachment name .
How to achieve??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 07:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 11:26 PM - edited ‎08-23-2024 11:27 PM
Try one more approach :-
function onSubmit() {
var attachmentNames = [];
var attachmentGR = new GlideRecord('sys_attachment');
attachmentGR.addQuery('table_sys_id', g_form.getUniqueValue());
attachmentGR.query();
while (attachmentGR.next()) {
attachmentNames.push(attachmentGR.getValue('file_name'));
}
if (attachmentNames.length > 0) {
alert('Attachments found: ' + attachmentNames.join(', '));
}
return true; // Allow the form to submit
}
try the above
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 07:31 AM
Hello,
You can create a Display --> BR
and use client like below :-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 11:26 PM - edited ‎08-23-2024 11:27 PM
Try one more approach :-
function onSubmit() {
var attachmentNames = [];
var attachmentGR = new GlideRecord('sys_attachment');
attachmentGR.addQuery('table_sys_id', g_form.getUniqueValue());
attachmentGR.query();
while (attachmentGR.next()) {
attachmentNames.push(attachmentGR.getValue('file_name'));
}
if (attachmentNames.length > 0) {
alert('Attachments found: ' + attachmentNames.join(', '));
}
return true; // Allow the form to submit
}
try the above