Remove Project Task Dependency through fix script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 07:14 PM
Hello,
i am having a difficulty in removing project task dependencies in bulk via fix script. I was able to remove the task relationship through this fix script, but the dependencies still showing in list view. Even .deleteRecord(); produces same results.
Note: Tried to delete values from dependency field as well, but list view values are still visible.
May i know what is the best way to remove project task dependencies in bulk?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 09:42 PM
Hi, your code appears to be trying to clear\delete reference data in the record rather than deleting the record, was this your intention? Partial screenshots are not the ideal way to share code for review\evaluation, perhaps you could update the thread with your code as plain text (or xml of the file) and share some details of your configuration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 10:53 PM
Thanks for your response.
I have used the deleteRecord() operation as well to permanently delete the relationship record, but still produces same results. Dependencies values are still visible from the list view even if I permamanently delete its planned task relationship.
Here is my code in text.
var pmtask0 = new GlideRecord('pm_project_task');
pmtask0.addEncodedQuery('short_descriptionINC206B Approve Test Readiness,C211A Approve Performance Test,C211B Approve Security Test,C211C Approve TCP,C211D Approve Operational Test');
pmtask0.query();
while (pmtask0.next()) {
pmtask0.dependency = "";
pmtask0.update();
pmtask0.setWorkflow(false);
}
var pmtask = new GlideRecord('planned_task_rel_planned_task');
pmtask.addEncodedQuery('parent.short_descriptionINC206B Approve Test Readiness,C211A Approve Performance Test,C211B Approve Security Test,C211C Approve TCP,C211D Approve Operational Test');
pmtask.query();
while (pmtask.next()) {
pmtask.parent = "";
pmtask.child = "";
pmtask.update();
pmtask.setWorkflow(false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 11:01 PM
Hi @Ahyel Libunao1 ,
Try with
var pmtask0 = new GlideRecord('pm_project_task');
pmtask0.addEncodedQuery('short_descriptionINC206B Approve Test Readiness,C211A Approve Performance Test,C211B Approve Security Test,C211C Approve TCP,C211D Approve Operational Test');
pmtask0.query();
while (pmtask0.next()) {
pmtask0.dependency = "";
pmtask0.setWorkflow(false);
pmtask0.update();
}
var pmtask = new GlideRecord('planned_task_rel_planned_task');
pmtask.addEncodedQuery('parent.short_descriptionINC206B Approve Test Readiness,C211A Approve Performance Test,C211B Approve Security Test,C211C Approve TCP,C211D Approve Operational Test');
pmtask.query();
while (pmtask.next()) {
pmtask.parent = "";
pmtask.child = "";
pmtask.setWorkflow(false);
pmtask.update();
}
Thanks and Regards,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 11:16 PM
Hi @Rahul Talreja,
I tried to run your provided script, and it worked partially.
It removed that task relationships (see image#1), however the dependency values are still showing in the list view of project tasks (see image#2).
Image #1
Image#2