I have a table of Cases with a drawer that shows Tasks related to that Case. Some of these Cases are going to have child cases with their own tasks, and I want that drawer to show tasks related to the parent case and any child cases.
I currently have a TaskModel that pulls in Tasks where Case__c = Id of row in context or where Case__r.ParentId = Id of row in context.
However, the context conditions of the table prevent both of those conditions from working. Basically I can set either of those conditions as context conditions, but if I try both, no data shows up.
This issue has been discussed here a number of years ago, but there was no resolution. Is there any way to add multiple context conditions to a table? Will I need two tables in the drawer to do this?
There is a solution, but it it working in the XML for the page. Context is simply component specific conditions. In other words, if you were to create the conditions and logic on the model with custom logic of 1 OR 2, you could copy these conditions w/ logic in place of the “context” conditions. Then it would work just fine.
Nice solution, Pat. This also seems like it could be useful declarative functionality, so I’m going to change this post to an idea so it can be surfaced to the devs as an idea
Thanks Pat, but that solution still isn’t working. This is the XML I have for the conditions in the table. No data is showing at all. I also tried setting the logic with logictype=“OR” and that didn’t work either.
<conditions logic="1 OR 2"> <condition type="contextrow" field="Case__c" mergefield="Id" operator="="/> <condition type="contextrow" field="Case__r.ParentId" mergefield="Id" operator="="/> </conditions>
Have you ensured that field and merge.field are in their respective models?
I have. The model for the Case table has Id and ParentId, and the model for the Tasks table has Case__c and Case__r.ParentId.
Hmmm… Further direct investigation would be needed. Looking at the component and list objects in the console and such.
Found a solution for this. I added a UI only formula field to the Task model. If the task’s Case has a parent, it will populate the Case’s ParentId, if not, it populates the Case Id. I then set the context condition to that formula field.
Still, it would be nice to be able to add logic to context conditions.
Nifty! Better than my solution for sure. Just be aware that aren’t able to create a Task in the drawer that will be set to the Case. Same goes for my solution for that matter.