Mass Update Knowledge Articles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2023 11:07 AM
Our Self Service KB has a default image put into the escalation path that gives end users the different avenues that they can use to contact IT for support. We have an updated image we want to replace it with for any new and current self service articles. I found a script I was able to modify to attempt to automate it, but was unable to get it to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 09:12 PM
It's possible that the script is not working because the articles are published and read-only. In ServiceNow, when an article is published, it becomes read-only and cannot be modified directly.
One solution could be to create a new version of the article, modify the Escalation Field with the new image, and publish the new version. This would allow you to update the image for any new and current self-service articles without modifying the existing published articles.
You can modify your script to create a new version of the article by adding the following lines before updating the record:
// Create a new version of the article
var newVersion = knowledge.createVersion();
newVersion.setValue('u_kb_escalation_path', '<p><img src="How%20to%20Get%20IT%20Support.png" width="751" height="350"/></p>');
newVersion.setWorkflow(false);
newVersion.update();
This will create a new version of the article and set the Escalation Field with the new image. The setWorkflow(false) method will prevent the new version from going through the approval workflow. Finally, the update() method will save the new version.
Note that this script will only update articles that have not been modified since deployment. If an article has been modified since deployment, the script will create a new version with the updated image, but the changes made to the article by the end user will not be preserved.
Please mark my answer as a solution/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.
Thanks,
Punit