“Copy Change” OOB UI Action in Geneva Instances copies Workflow-driven change tasks
When you use “Copy Change” OOB UI Action in Geneva instance then you may notice that change tasks generated by workflows are copied along with manual change tasks. Obviously when you copy a change only manual change tasks should be copied as workflow-driven change tasks will be generated (in new copied change) by the workflow.
Refer to the Product Documentation: https://docs.servicenow.com/bundle/geneva-it-service-management/page/product/change_management/concept/c_CopyAChange.html
ServiceNow created a new field called “Created from” (created_from) on change_task with default value “manual” and Script Include ChangeUtilsSNCmethod makeRelatedTableCopy is configured in a way to not copy change tasks with created_from= “workflow”.
However there are no measures taken to set created_from= “workflow” for workflow-driven change tasks which generates the issue mentioned above.
How to solve it:
1) Create a before Insert Business Rule over change_task table that will act as follows:
- When “Workflow Activity” (wf_activity) is not EMPTY
- Set “Created From” = “workflow”
2) In case you already run the instance for a while and there are change tasks existing in your workflow-driven changes (all with “Created from”=”workflow”) then you might want to update workflow-driven change tasks to avoid getting them copied when you copy a change:
Create “onDemand” Scheduled Job with a script below and execute it:
var ct = new GlideRecord(‘change_task’);
ct.created_from = ‘workflow’;
gs.log(ct.getRowCount()+’ change tasks have been updated. Wo-hoo!!!’,’created_from’);
This post was first published on LinkedIn.