- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I need to submit a Catalog Item during a test, but there is a mandatory attachment field.
The issue is that when using "Set Variable Values" the input appears as a String/Single Line Text field, so I can't mock a generic image (for example) which would be sufficient, since the field itself isn't the focus of the test, just a requirement for submission.
Even using a "File Attachment" parameter doesn't seem to work. Does anyone know a workaround for this to submit the form via ATF?
It is worth mentioning that I have already tried using a sys_attachment sys_id in this input. I also tried using a different "Add Attachments" test step, but it only works for that OOB field at the bottom of the form, not for custom variables.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The solution that worked for me was using the sys_id of a sys_attachment record directly in the string input generated by the attachment field, as suggested.
However, the important detail is that the "Table name" column is empty; presumably, if the test were performed by a user with access to that specific table or an admin role, this wouldn't be an issue.
Thank you all for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @paulomafra
Get the sys_id of any valid attachment from the sys_attachment table.
In the Set Variable Values step, pass that sys_id into your attachment variable. The form will accept it as a valid uploaded file.
This helps other users find accurate and useful information more easily
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Unfortunately, it still hasn't solved my problem—even after querying `sys_attachment` for a valid record and adding that ID to the input. I also can't use that return value with a dynamic parameter.
The result is the same as mocking a sys_id directly in the input without a prior query: Invalid value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
did you check this?
Adding attachment to record producer in ATF
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
it did work for me
Steps: I gave sysId of any 1 sys_attachment record as input
Output: File attached to variable
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
