How to Create attachment with same sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 03:25 AM
Hi Community,
I am doing the integration with between the two servicenow instances for knowledge management, in this case if i add the any attachment on knowledge article body, the same content should reflect into the target instance, in this case attachment sys_id should be same in the both the instances. In this case how we can create attachment on target instance with the same sys_id in the source instance. Someone please help me on this.
Thanks in advance,
Harsha Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 03:47 AM
Please take the export of xmls of data related to attachments from these two tables.
1) go to sys_attachment table and find the record related to your knowledge article and take export of it.
Hint: sort it using table sysid field provided with value of your knowledge article sys id.
2) go to attachment documents table and find the records related to the attachment and take XML export of those.
Hint: you can search with attachment name in this table.
Then import the xmls of both tables into your target instance. This will fulfill your requirement.
Kindly mark the answer Correct and Helpful if it helps to resolve your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 03:56 AM
Hi @Chaitanya naram ,
Is there any api to export the attachment data and import into the target instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 04:02 AM
You can capture the updates in your update set using GlideUpdateManager2() api and then you commit in your target instance.
var rec = new GlideRecord('sys_number');
rec.get('973c8e8a9d022000da615b13b3a22f32');
//Push the record into the current update set
var um = new GlideUpdateManager2();
um.saveRecord(rec);
Or use the Attachment API provided by servicenow
Kindly mark the answer Correct and Helpful if it helps to resolve your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 04:06 AM
If we are using the Attachment API then its creating the attahcment with different sys-id right