Knowledge Base Articles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi fellows,
I am working on a task in my organization. Where some articles are pushed to draft state by the system and some of them are in pending retirement state. My task is to move them back to published state which i did already. As the company does not want me to move them to draft state by rejecting the approval state and from there i can see two layers of higher-management approvals which will move the articles to published state if the proper flow is followed.
I personally pushed the kb articles to published state via a fix script and used the set workflow (false). For articles in draft i did not use set workflow as false as the system did let me move without an issue. But the articles which were in pending retirement state were not going to published state without me using set workflow false operation. Now after some weeks' time the workflow has pushed the articles back to pending retirement state regardless of valid to date as 2027.
Can someone guide me what is the best way to accomplish this requirement so that proper versioning can take place and the audit can be taken care of in future!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
hey @mubarik hassan1
This behavior is expected due to how Knowledge lifecycle works when it is bypassed using scripts.
You moved the articles to Published using setWorkflow(false), which updated the record state but did not update or remove the underlying lifecycle context (approvals, retirement triggers, workflow/flow executions). Because of this, the system later re-evaluates the articles and moves them back to Pending Retirement.
Root Cause
In ServiceNow, Knowledge Management is process-driven, not just state-driven.
Even if workflow_state = published, the platform still evaluates:
Approval records (sysapproval_approver)
Workflow / Flow Designer context
Scheduled lifecycle jobs
Fields like valid_to and retirement flags
Since setWorkflow(false) skips business rules and flows, these backend conditions remain active - causing the rollback.
Solution
1. Identify retirement triggers
Check what is forcing the article into Pending Retirement:
Active retirement approvals
Workflow (wf_context) or Flow Designer executions
Scheduled jobs (knowledge lifecycle)
Incorrect valid_to or lifecycle fields
2. Handle approval records
Navigate to related approvals (sysapproval_approver)
Cancel or close retirement approvals appropriately
If approvals remain active, the system will continue reverting the state.
3. Clear workflow / flow context
Check wf_context (workflow)
Check Flow Designer execution
If active:
Cancel or clean them up to stop reprocessing
4. Use versioning + approval (Best Practice)
For articles that need to be active again:
Use Checkout to create a new version
Make required updates (if any)
Submit for approval
Allow the approval flow to move it to Published
This ensures:
Proper version history
Full audit trail
No lifecycle conflicts
5. Validate scheduled jobs / custom logic
Review Knowledge lifecycle scheduled jobs
Check any custom Flow Designer logic
Ensure:
Articles with future valid_to dates (e.g., 2027) are not incorrectly picked
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
So people did not do what they should have done and you are tasked by cleaning that up and are using scripts for that that are updating things without following the logic that is in place?
Why aren't you allowed to reject the approval? They asked you to clean up the mess they made. Follow the path that you are supposed to follow and if they don't allow it, have them retire the articles and create new ones. The company should only provide you the requirement, not the solution.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @mubarik hassan1,
What happened is expected behavior in ServiceNow. When you used setWorkflow(false), you forced the articles to be published but didn’t stop the underlying retirement workflow. Those articles already had active workflow contexts and approvals running in the background. So after some time, the system re-evaluated them and pushed them back to pending retirement.
The correct way is to first cancel the workflow context and clear any related approval records. Then move the article back to Draft and follow the proper publishing process (with approvals). Avoid directly forcing states in production, as it breaks audit and versioning.
Right now your situation is like:
You manually marked something as "approved," but the approval process was still running in the background. 😄
In short, don’t bypass the lifecycle; reset it and let it run properly so changes stay permanent.
Let me know if this helps!!!😉
If you find my answer useful, please mark it as Helpful and Correct. 😊
Regards,
Soham Tipnis
ServiceNow Developer || Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10
