How to handle mandatory attachment field on a form in ATF?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello all
I have a custom attachment field on the change request form which I need to automate using ATF. How do I handle the mandatory attachment field using 'Set Field Values' step?
I have already tried to use 'Record Query' to query a random attachment on the 'sys_attachment' table but it does not allow me to refer on the 'Set Field Values' step.
Hard coding the sys_id of a random attachment on the field also did not work.
Please help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi @Mayank Das3
To add a mandatory attachment in Automated Test Framework (ATF) for a form, you need to use a workaround since standard "mandatory" fields are not supported for attachments. A common approach is to use the "Add Attachment" step in the ATF, and on the form, use a client-side script or a business rule to enforce the attachment requirement before submission.
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
11 hours ago
and follow the below thread
https://www.servicenow.com/community/developer-forum/how-to-add-attachment-to-a-mandatory-attachment...
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/
