Unable to attach attachment to data source table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 03:01 AM
Hi All,
Target: generate attachment through third party integration and add it into data source.
I am using below code to generate attachment through rest message and attache to data source but not getting attachment. when i am trying with incident table its working perfectly but also getResponseAttachmentSysid() returns null.
any help appreciate.
//Data Source Code:
var integrationProcessGrTable="sys_data_source";
var gr1="29c4123d2f834010d0a6cc96f699b6dd";
var fileName="vuNT_.json" ;
var request = new sn_ws.RESTMessageV2('test', 'Default GET');
request.saveResponseBodyAsAttachment(integrationProcessGrTable, gr1, fileName);
response = request.execute();
httpResponseStatus = response.getStatusCode();
gs.print("Attachment sys_id :-"+response.getResponseAttachmentSysid())
gs.print(" http response status_code: " + httpResponseStatus);
-----------------------------------------------------------------------------------------------------------------------------------------------
//Incident Code
//Working but getResponseAttachmentSysid() returns null
var integrationProcessGrTable="incident";
var gr1="ad6f1ef12fc34010d0a6cc96f699b6b2";
var fileName="vuNT_.json" ;
var request = new sn_ws.RESTMessageV2('test', 'Default GET');
request.saveResponseBodyAsAttachment(integrationProcessGrTable, gr1, fileName);
response = request.execute();
httpResponseStatus = response.getStatusCode();
gs.print("Attachment sys_id :-"+response.getResponseAttachmentSysid())
gs.print(" http response status_code: " + httpResponseStatus);
Thanks in Advance
Vinayak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 08:06 AM
Hi Vinayak,
as an admin from the data source record are you able to attach the file using attachment icon?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 08:23 AM
Have you considered using the REST Attachment API instead: