Punit S
Giga Guru

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