- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 08:12 AM
I am working with the Project Task Table and created a field called Task Name. We are using that instead of Short Description. Well after a year or two, we want to switch back to Short Description and not use Task Name. I need to copy over the value of Task Name to Short Description on every record. What is the best way to do this? Background script? Scheduled Job? I am not the best scriptor so a little guidance would be great!
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 08:16 AM
Hi Adam,
For a one-off, scripts background will do it.
Standard disclaimer: The following code is untested, requires review and potential modifications.
(function () {
var rec = new GlideRecord('pm_project_task');
rec.query();
while (rec.next()) {
rec.short_description = rec.u_task_name;
rec.setWorkflow(false); // do not trigger business rules/workflows
rec.autoSysFields(false); // do not update system fields
rec.update();
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 08:16 AM
Hi Adam,
For a one-off, scripts background will do it.
Standard disclaimer: The following code is untested, requires review and potential modifications.
(function () {
var rec = new GlideRecord('pm_project_task');
rec.query();
while (rec.next()) {
rec.short_description = rec.u_task_name;
rec.setWorkflow(false); // do not trigger business rules/workflows
rec.autoSysFields(false); // do not update system fields
rec.update();
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 08:27 AM
Thank you. That worked.
Here is the script I used that might help someone else.
var rec = new GlideRecord('pm_project_task');
rec.query();
while (rec.next()) {
rec.short_description = rec.u_task_name;
rec.setWorkflow(false);
rec.autoSysFields(false);
rec.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 08:34 AM
Nice work! I'll update my script to get rid of the typos!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 02:31 AM
Hello Chuck,
Can you please tell me how to do this for a single record(for testing purpose).
Below is my script :
var gr = new GlideRecord('incident');
gr.addQuery('u_next_check_time_reason','=','executive summary');
gr.query();
while (gr.next())
{
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.DeleteRecord();
}