- 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
Hello,
You can create a Display --> BR
and use client like below :-
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- 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
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- 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 :-
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- 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
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/