Create new record with attachment from external system - API

Dhathri
Tera Contributor

Hi All, 

 

I have below requirement.

 

EXTERNAL SYSTEM       (Sends Individual PDF files)    

   

                               |

ServiceNow, Submits a catalog item with PDF attached

                               |

After completion of RITM, txt file send back to external system

I need help in
step 1: EXTERNAL SYSTEM       (Sends Individual PDF files)

step 2: ServiceNow, Submits a catalog item with PDF attached

 

#developer

                          

 

7 REPLIES 7

TharaS657398130
Giga Guru

Hey there

You basically need a simple flow: first, let the external system send the PDF into ServiceNow either via a REST API (best option) or email (easiest), where you receive and store the file (ideally in a staging record); then, once the file is received, trigger a script or Flow Designer to automatically create a catalog request (RITM) and attach that same PDF to it using GlideSysAttachment—so in short, receive the file → store it → create RITM → attach the file.

 
 
 

Tanushree Maiti
Kilo Patron

Hi @Dhathri 

 

Option1 :

a. Create the Record: Use the Table API to create your record (e.g., Incident, Case).
Endpoint: POST /api/now/table/{tableName}
Action: Capture the sys_id of the newly created record from the response body.

b. Upload the Attachment: Use the Attachment API to link the file to that sys_id.
Endpoint: POST /api/now/attachment/file?table_name={tableName}&table_sys_id={sys_id}&file_name={name}
Body: Send the raw binary data of the file.
Header: Set Content-Type to the file's MIME type (e.g., image/png).

 

Refer: Create Atachment in ServiceNow Using Attachment API and OAuth Authorization

Administering attachments 

Effortlessly Attach API Responses File to Record: Use saveResponseBodyAsAttachment()

Add attachments to change requests using attachment API 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@Dhathri 

Approach

1) create scripted REST API and share endpoint and credentials etc to 3rd party

Ask them to send details for your catalog item variables, along with the PDF file details (file name, base64Encoded data etc)

2) then use CartJS API to submit the catalog item

sharing below link for your help

Sending attachments using custom scripted web service 

I shared solution here few years ago, check that and enhance

Scripted rest api 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Ankur Bawiskar , User will be sending only pdf document to servicenow, My requirement is to attach the document to the catalog item and submit the order.