need fix script to copy the html field in kb_knowledge base to another Html field of article templat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 05:47 AM
Hi Everyone,
I have a requirement that i need to copy the content from one Html field (question field) to another HTML field(Answer field).
Here Question field was created in Knowledge base table (kb_knowledge_base).
and i created one custom HTML field Called it as Answer field in Article template table (kb_template_faq).
now i have to copy the data from Question field to Answer field , but iam unable to copy the data.
Could You please help me on this one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 06:02 AM
function copyHTMLField(copyFrom, copyTo){
var ka = new GlideRecord('kb_knowledge');
ka.get(copyFrom);
var kTemplate = new GlideRecord('kb_template_faq');
kTemplate.get(copyTo);
kTemplate.<html field name here> = ka.text;
kTemplate.update();
}
copyHTMLField('<enter sys id of question record>', '<enter sys id of answer record');
Why not try something like this. You can then pass the values into the function from a gliderecord in a loop if you wanted to complete this for many records at once
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 02:35 PM
This does not copy over exactly the HTML code, for example those nasty " " strings are ignored, not copied over. So the two HTML fields will not be exactly the same.