We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Simple information message to be displayed when article workflow is draft

MohammedYaseen
Tera Expert

Hi All,

 

I want to display an info message to add attachment whenever the knowledge article is in draft stage

Please provide the client script to add workflow as draft

Thanks

2 ACCEPTED SOLUTIONS

Abhijit4
Mega Sage

Hi @MohammedYaseen 

 

You can simple create an on  load client script with below script:

 

 if(g_form.getValue("workflow_state")=="draft"){
	g_form.addInfoMessage("Please add attachment");
   }

Client script configuration:

Abhijit4_0-1747317969696.png

You can also achieve same by using UI policy also.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron

Hi @MohammedYaseen 

You can create an on load script on KB table and add code like

 

g_form.addInfoMessage("This article in in draft state")

 

 

https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/script/general-scripting/referenc...

*************************************************************************************************************
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]

****************************************************************************************************************

This is easy way  Create a UI policy

 

State = Draft

 

in Script add 

above code.

*************************************************************************************************************
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]

****************************************************************************************************************

Thanks Atul.

Abhijit4
Mega Sage

Hi @MohammedYaseen 

 

You can simple create an on  load client script with below script:

 

 if(g_form.getValue("workflow_state")=="draft"){
	g_form.addInfoMessage("Please add attachment");
   }

Client script configuration:

Abhijit4_0-1747317969696.png

You can also achieve same by using UI policy also.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP