Problem displaying tasks for both parent and child records in same table

  • 1
  • Question
  • Updated 3 years ago
Hi, we use a table that previously just displayed completed tasks relating to a parent object. We're now creating completed tasks via workflow for child records which we want to display in the same table. I've added a condition to include tasks where WhatId = ChildRecord ID, and changed the grouping logic to include either these OR the ParentRecord ID. However the records displayed are inconsistent in that sometimes the child record task is not being displayed. Another scenario is only one task is being displayed even though a separate task has been created for each of 3 child records. Not sure what to try next.
Photo of Dan Russell

Dan Russell

  • 110 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
If I am understanding you correctly, your table is on a parent record detail page. In that case, there is only one parentRecordId in context so when you add a condition of WhatId=ParentRecordID it knows that ParentRecordID must be the only ParentRecordID in context (row 0). Adding a condition of WhatId=ChildRecordID may confuse it as it doesn't know which ChildRecordID is in context since there could be many for each parent.
I think you would need to change your second condition to look through the child record to the ParentRecordID. So instead of WhatID=ParentRecordId, you would have to set the ParentRecordID of the WhatID equal to ParentRecordID. I'm not sure if tasks let you look into the fields of the WhatId to find the ParentRecordID. If not, then you've got some issues. You may have to do two separate tables. The first table would be your original parent task table. The second table would be based not on the tasks object, but on the child record object. This would list all the child records of the parent. You would then add a drawer to that table to display the tasks of each child record.
Someone else may have a better solution and I have limited experience with conditions on the task object, so I may be off in my thinking. Good luck.