- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 04:25 PM
I see from this link, https://community.servicenow.com/thread/236445?q=How%20to%20revert%20workflow
that one can revert to a prior workflow with this code:
For deactivating the current.
var getInc = new GlideRecord('wf_workflow_version');
if(getInc.get('3b95753ad0d60200085a28e2b5794e1e')) //change
{
getInc.published=false;
getInc.update();
}
To publish old one
var getInc = new GlideRecord('wf_workflow_version');
if(getInc.get('3b95753ad0d60200085a28e2b5794e1e')) //change
{
getInc.published=true;
getInc.update();
}
I understand one can not revert through the UI interface that this needs to be done pro-grammatically, but, couple of questions.
1) From the example above, I am guessing '3b95753ad0d60200085a28e2b5794e1e' is the reference to a specific workflow version.
Is that the same string I see in the name when I export the workflow to a .XML file?
2) Where exactly do I go to run that code? Would I run that as a new Fix Script?
Would this work ?
a) Export a working workflow.
b) Delete the problematic workflow (Ah, scratch this, I see it will not let me delete the current workflow).
c) Import the working workflow version
Thank you in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2016 01:12 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 11:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 11:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2016 11:08 AM
Nice ! I wasn't aware of the right click, trick.... looks useful.
FWIW - the Sys ID is the string output into the file name when you export the workflow.
Interestingly, in the "Show List" of the wf_workflow_version table the gear doesn't show the Sys ID.
I had to create a database view on the table to be able to add the Sys ID.
But I've got it. Now just need to know where to run that code so I can disable the current workflow version.
Thank you for your insights.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2016 11:03 AM
Hi Deep K,
Thank you for your response.
While I have administrator privileges on the platform, our platform is Geneva, and I am not seeing a "Scripts - Background" on my left side menu. Does it go by another name?
Under System Definition I have these choices:
Script Includes
Fix Scripts
Client Scripts
Validation Scripts
I just want to make sure I run the code in the right place so I don't mess up the other 300 workflows already in the system.