Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Can someone with more ATF experience help me with this?

paulomafra
Tera Contributor

 

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.

1 ACCEPTED SOLUTION

paulomafra
Tera Contributor

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!

View solution in original post

9 REPLIES 9

@paulomafra 

Just following up to see whether my suggested solution worked for you.

If you're still facing any issues, I'd be happy to help further.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

paulomafra_4-1786891905347.pngpaulomafra_5-1786891915463.png

paulomafra_6-1786891923043.png

Unfortunately, it still hasn't solved my problem. For some reason the variable does not accept even an valid attachment sys_id.

masonreed11
Tera Contributor

For custom attachment variables, ATF’s standard Add Attachments step doesn’t handle them well. A common workaround is to create a dummy attachment via a server-side script and associate it with the relevant record before submitting the Catalog Item. Passing the sys_attachment sys_id directly usually won’t work because the variable expects a different value format.

paulomafra
Tera Contributor

I managed to get it working by using a sys_id of sys_attachment record directly in the string input, but the catch is: the Table name collumn is empty.

paulomafra_0-1786892896752.png

 

The impersonated user's lack of access likely affects the reference used in the form.

paulomafra
Tera Contributor

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!