Applying New workflow version to old records/workflow

kduong
Giga Contributor

Is it possible to apply the latest workflow version to old records/workflow?

I know there is a way to restart the workflow. Am I correct in saying that the restart workflow will restart the current workflow associated with the record? meaning it will restart the old workflow?

1 ACCEPTED SOLUTION

HI Ken,



I don't have script handy. Please refer below link on how you can restart workflow.


Workflow Script - ServiceNow Wiki


View solution in original post

11 REPLIES 11

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Ken,



The new version of the workflow will not be associated with the old records. There is really no way to find which ones have the old ones, or which one refer to new ones, except that you will have to manually open them and see the contexts.



The way in which you will have to apply the new version is by cancelling the old Workflow and attaching the new workflow by Script.


Hi Pradeep,



We have a general idea on which records have very out to date workflow version. We are trying to update these records with our current workflow.



Do you have an example script of attaching a new workflow to a record?



Thanks,


Ken


HI Ken,



I don't have script handy. Please refer below link on how you can restart workflow.


Workflow Script - ServiceNow Wiki


Problem is that is that if you restart, it's the old one that is restarted.



There are a couple of ways to attach the new one. You can set conditions on the workflow and when they are true, the workflow will attach it self. Next thing is that the new workflow is starting form the start, so if you were in the middle of the old one, the new one will start at the beginning. So it is always a pros Vs cons if you just want the old ones to finish and apply the new ones on new records.



How to start workflows with scripts you can look at the link Pradeep posted or the one at docs: https://developer.servicenow.com/app.do#!/api_doc?v=geneva&type=server&scoped=false&to=method_class_...



But If you can, it is easiest way to put it in the conditions on the workflow if the circumstances are right 😃




//Göran