How to upload data into comments of content type blogs into domain seperated instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2024 01:51 PM - edited ‎01-04-2024 06:03 AM
Hi all ,
We have a requirement to import the community data as Blogs and its comment from excel into service now.
I have tried implementing the blogs part into snow seperately and comments part seperately.
The blogs part have been imported successfully into Servicenow with the help of this transform map and an onafter script .
Now I have tried with the same way of importing the comments for the respective blogs its not working .It creating comments in kb_social_qa_comment but not creating records in contents table as well as in comments reference id is also not updating in comments.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code her
var profile = new GlideRecord("live_profile");
if (profile.get("document", source.u_profile)) {
var blog = new GlideRecord("sn_communities_blog");
if (blog.get("title", source.u_title)) {
var content = new GlideRecord('sn_communities_content');
content.initialize();
content.profile = profile.getValue("sys_id");
content.forum_id = source.u_forum_id;
content.topics = source.u_topics;
content.view_count = source.u_view_count;
content.like_count = source.u_like_count;
content.helpful_count = source.u_helpful_count;
content.sys_created_on = source.u_sys_created_on;
content.upvote_count = source.u_upvote_count;
content.rating = source.u_rating;
content.comment_count = source.u_comment_count;
content.meta_description = source.u_meta_description;
content.setValue('content_type', source.u_content_type);
content.content_id = target.sys_id;
content.content_name = 'kb_social_qa_comment';
content.state = 'published';
content.setWorkflow(false);
content.insert();
target.content = content.getUniqueValue();
target.reference_id = blog.getValue("sys_id");
target.setWorkflow(false);
target.update();
}
} else {
gs.info('live_profile not existed');
}
})(source, map, log, target);
Kindly suggest on the issue how to proceed further .
@Danielle Gallo - Do u have any suggestions on this.