Remove Project Task Dependency through fix script

Ahyel Libunao1
Tera Contributor

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.

 

AhyelLibunao1_1-1690164757648.png

Note: Tried to delete values from dependency field as well, but list view values are still visible. 

AhyelLibunao1_2-1690164801406.png

 

May i know what is the best way to remove project task dependencies in bulk? 

 

Thanks in advance!

 

 

7 REPLIES 7

Tony Chatfield1
Kilo Patron

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?

Hi @Tony Chatfield1 

 

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);
}

Rahul Talreja
Mega Sage
Mega Sage

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();

}
Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

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

AhyelLibunao1_1-1690179359933.png

 

Image#2

AhyelLibunao1_0-1690179325231.png