- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 12:40 AM
Hello Experts,
How can we configure Outbound Rest message to send attachment to 3rd party(cloudplus) which later can be used in business rule?
Or is there other way of writing business rule for the same.
Do we need to encode it into Base64 before sending?
I am bit confused.
Any Help would be appreciated.
Thanks
Neeraj Sharma
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2017 02:19 AM
finally i am able to successfully send attachment to 3rd party and viceversa via rest.
Points to Remember.
Sending attachments (serviceNow to 3rd party)
1. Outbound Rest message- Need to ask for a endpoint of the 3rd party. Configure HTTP headers If any.
2. Use this Rest message in the business rule to send attachments
a. Call the rest message and simply send the binary content of the attachment to the request body using function request.setRequestBodyFromAttachment('<attachment sys_id>');
(RESTMessageV2 - setRequestBodyFromAttachment(String attachmentSysId) )
Screenshot of the business rule
And you will see Magic happens.
Receiving attachments (3rd party to serviceNow)
1. Go Rest API explorer > select Attachment API in API name and explore all the APIs available (Get, Post, Delete)
For are two ways of making Post request :-
a) https://yourinstance.service-now.com/api/now/attachment/file
b) https://dev33253.service-now.com/api/now/attachment/upload
table_name = Table name ( incident for above case)
table_sys_id = Unique Id of the record to which attachment needs to be inserted.
file_name = name of the attachment.
In HTTP header you need to send Content-Type Also (Not mandatory but always good to give).
Postman Screenshots
Hope this will be helpful.
Thanks
Neeraj sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2017 06:57 AM
Hi kumaran,
What are all the informations need to send other than attachment sys_id.
That depends on the tool you are integrating with. if its serviceNow to serviceNow integration then you need to send
table_name = Table name ( incident for above case)
table_sys_id = Unique Id of the record to which attachment needs to be inserted.
file_name = name of the attachment.
In HTTP header you need to send Content-Type Also (Not mandatory but always good to give).
Thanks
Neeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 11:12 PM
Hi Neeraj,
I see yu have added attachemnt sysid . when we add a attachment a attachment to any record, it gets stored in sys attachment table. We need to fetch that and put that here in the sys_id?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 12:50 AM
Hi Neeraj,
Can we use POST also to send attachment from snow to 3rd party system?
POST usually says create. So, i wud just want to update the record with the attachment. This would also need a POST or PUT should be good?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 09:27 AM
Hi Surya,
The method used is generally depends on the 3rd party tool, If its serviceNow to serviceNow integration POST will work fine.
Also you can explore all the Attachment API in Rest Explorer.
Helpful link
http://wiki.servicenow.com/index.php?title=REST_API_Explorer#gsc.tab=0
Regards
Neeraj Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 09:38 AM
Hi Neeraj
I was successfully able to post back to 3rd party tool.
when they send an attachment fom 3rd party tool , i am not able to add it to record.
Can you explain the exact steps for it? Script how it gets added to that record.