- 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
‎01-15-2019 04:08 AM
For a single record, add
gr.setLimit(1);
before your query() call. That will tell the GlideRecord API to only fetch a maximum of 1 record.
If you're going to delete the record, then you really don't need autoSysFields() in there.
Also, change gr.DeleteRecord() to gr.deleteRecord().