O/P - 1
O/P - 2
O/P - 3
When I directly query the comments table with a filter to fetch comments where the audit is null, it returns the expected results(O/P - 1). However, when I apply the same filter in a related record query from the main test table, it does not return any comments(O/P - 2). Interestingly, if I remove the audit filter, the related record query returns the correct data(O/P - 3). Any idea what could be causing this issue?
Discussion posts and replies are publicly visible
The relationship to 'testAudit1' is referenced in the filters, you should have a field here. If you want to fetch comments where audit is null why not put filter simply as
a!queryfilter( field:RS Test Comment.auditId, operator:"is null")
Its difficult to understand the structure and relationship with the records here with the given details
Thank you for your response. The relationship between Comment and Audit is one-to-one, established through the field commentId. (Please disregard auditId in the Comment table, as the actual Comment table does not include an auditId field.) FYI commentId is unique in audit table.Test -> Comment -> audit
In that case for all the scenarios can you try referencing till the audit field instead of (as it looks like now) till relationship reference.
In your screenshots if you focus on the icons for field reference you can notice the testAudit1 is a relation ship. But when you reference a field from the relationship then icon should be of the field. So put correct field reference in all three scenarios and then check. As of now the configuration seems incorrect so not right to compare the results and behavior.
I tried adding audit field as well its not working. However if we look at O/P -1 result, it's giving expected result even though we pass related record in field(line 12).
I tried to test the scenario like yours and it is interesting! And so far I feel the difference in behavior between O/p 1 or O/p 3 versus o/P 2 is due to a!relatedRecordData().
In scenario 2, you are querying on Record 'Test'. Then in related record you are filtering the 'Comment' record but you are also trying to filter the audit record which is a 2nd level related record to 'Test' and 1st level to 'Comment' record.
As per description given for a!relatedRecordData() there is a hint of suggestion to filter using only the referenced related record type! In your case you should filter only the 'Comment' record here.
Basis the above I am gathering a!relatedRecordData() is not meant to query from 2nd level related record in the manner you are trying to.
So better to query in main filter, and I believe O/P 2 behavior , is not a code issue rather functionality supported by a!relatedRecordData().
yeah, may be you're right, that is not supported by a!relatedRecordData(). ~Thanks for your time.