Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

ATF Test Step Attachment

YakupT
Tera Contributor

Hi,

 

I have the challenge in a ATF test case do add an attachment to a field in a form. The attachment I managed to add the attachment with the test step "Add Attachments to Form". But I do not know with which test step, I can set it in a field. 

 

Regards

1 ACCEPTED SOLUTION

Shaqeel
Mega Sage
Mega Sage

Hi @YakupT 

 

This is a very tricky one since there is an option on adding attachment on a form but not on field.

You have to use Server side script step to create an attachment and then set the field value with sys_id of that attachment.

One more way you can try is you can create custom atf step and define a new step like "Attach file to record"

Internally that step uses GlideSysAttach,emt API.

You can use it in multiple tests.

 

Regards

ShqL


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel

View solution in original post

2 REPLIES 2

Shaqeel
Mega Sage
Mega Sage

Hi @YakupT 

 

This is a very tricky one since there is an option on adding attachment on a form but not on field.

You have to use Server side script step to create an attachment and then set the field value with sys_id of that attachment.

One more way you can try is you can create custom atf step and define a new step like "Attach file to record"

Internally that step uses GlideSysAttach,emt API.

You can use it in multiple tests.

 

Regards

ShqL


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel

Hi Shaqeel,

 

Thanks for your reply.

Yes, I tried the Step "Add Attachments to Form" and selected the file(s) to attach.  I tried 2 files to attach:  1 is a Word document file; the other 1 is a .PNG file containg a sample screenshot.

Both of them generates the error "Invalid table" during test execution.

 

Thanks.

Gilbert