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-05-2020 11:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 05:43 AM
Hi Tony,
Yes I have validated by manually and it's works. i want to add this file to process data through data source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 02:34 AM
Hi Vinayak,
with which user profile you are using the API? Does that user has write access to the table?
I believe users with import_admin can add file to data source as attachment
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 05:47 AM
Hi Ankur,
I am checking with admin profile.
when i am trying for incident table (at the place of data_source) it working file getting generated and attached to record. but for any other table(i have tried with data source and custom table) it's not working.
Also i am not getting attachment sys_id.