Now Mobile Attachment Input Not Attaching File to Incident Created via Scripted Action

TEJAS
Tera Contributor

Hi everyone,

I'm working on a Now Mobile application where users can create an Incident using an Input Form Screen and i have added Scripted Action for attachment.

Setup

Input Form Screen

Screen: Create Incident

Added an input field:

Name: attachment

Type: Attachment

Scripted Action

(function WriteBackAction(parm_input, parm_variable, actionResult) {

 

actionResult.addAttachment( "attachment", "incident", gr.getUniqueValue());

})(parm_input, parm_variable, actionResult);

 

Issue

The Incident is created successfully from the mobile app.

The file upload appears to complete successfully.

However, the attachment is not associated with the created Incident.

No attachment appears on the Incident record.

No attachment appears in the Activity Stream.

 

What I Found

Instead of seeing a record linked to the Incident in sys_attachment, I see data like:

[

{

"email_table_name":"sys_email",

"email_sys_id":"c0a0ca9b838d8750145417447daad306",

"job_id":"6fd002db838d8750145417447daad3ed",

"state":"SENT"

}

]

It seems the attachment is being processed through sys_email rather than being attached to the Incident record.

 

Questions

Has anyone successfully used actionResult.addAttachment() with an Attachment Input in Now Mobile?

Are there additional steps required after addAttachment() to associate the uploaded file with the Incident?

Should the attachment input automatically create a record in sys_attachment, or is additional configuration required?

Has anyone seen attachments being routed to sys_email instead of the target table?

 

Any guidance would be greatly appreciated.

Thank you.

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @TEJAS  

 

 

Check This:

Attachment is not getting added from mobile input screen to the record 

 

Servicenow Doc: Configure an action item 

Servicenow Doc:Script code for storing user-selected attachments in the database 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Refer these videos as well:

https://www.youtube.com/watch?v=JeaPgYgLyiw

https://www.youtube.com/watch?v=vqFe-8PeORQ

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
Learn how to set up Input Forms in the ServiceNow Mobile App. This video covers how to create and customize mobile-friendly forms, making it easy for users to submit and update information directly from their device.
Today David Ha, Senior Product Manager, walks us through the how to configure a write-back action function. We'll begin with a quick overview, then dive into the step-by-step exercise, answering audience questions along the way. Timestamps: Intro & Overview - 0:00 Exercise - 8:38 We are live on ...