- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi All,
I have a requirement on the knowledge article form.
Whenever user clicks on the publish ui action button it always redirects to the list view. User wanted it to stay on the same page.
Below is the Publish UI action script.
function onPublishActionClicked() {
if (g_form.getTableName() == "kb_knowledge_block")
gsftSubmit(null, g_form.getFormElement(), 'publish_knowledge');
else {
var checkGuestAccess = new GlideAjax("KBAjax");
checkGuestAccess.addParam("sysparm_type", "checkGuestUserHasAccess");
checkGuestAccess.addParam("sysparm_id", g_form.getUniqueValue());
checkGuestAccess.getXML(function(response) {
var answer = '';
if (response && response.responseXML && response.responseXML.documentElement)
answer = response.responseXML.documentElement.getAttribute("answer") + '' == 'true' ? true : false;
if (answer)
renderModal();
else
gsftSubmit(null, g_form.getFormElement(), 'publish_knowledge');
});
}
}
function renderModal() {
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
dialog = new dialogClass('confirm_publish');
dialog.setTitle('Confirmation');
dialog.setWidth(450);
dialog.render();
}
if (typeof window == 'undefined') {
publish();
}
function closeDialogAndPublish() {
dialog.destroy();
gsftSubmit(null, g_form.getFormElement(), 'publish_knowledge');
}
function publish() {
new global.KnowledgeUIAction().publish(current);
}could you please assist me on this.
Thanks & Regards.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Since that's OOTB UI action I will recommend not to update
but if you still require then add this line and see
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Joshuu
This is a platform-defined and expected behavior, and I would recommend not changing it. Instead of creating technical debt, it’s better to educate users on how the platform is designed to work.
Also, consider the user flow: how will users return to the same page if they need to approve another article, then go back to the list view to search and publish?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Since that's OOTB UI action I will recommend not to update
but if you still require then add this line and see
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@Joshuu ,
There is below line of statement is missing in server script. Please check the written answer by @Ankur Bawiskar
action.setRedirectURL(current)
Please mark accepted solution if this resolves your query.
Supriya Waghmode |ServiceNow Consultant
