Cannot view reports submitted at CHV level

I have a form which sits at the chv profile level and there are some questions in the form which are supposed to be asked starting from second visit onwards.
I created a function in contact-summary-extras to count the number of forms submitted for a particular chv and return the count value in the form.
The function however always returns 0 even though I have already submitted the form. I can see the document I submitted in couch.
I submitted the form using a user with supervisor role.

Can you help me identify the cause of the issue?
Here’s the function:

  getQualityMonitoringCount: function() { 
    console.log( => r.form));  // returns nothing 
    console.log(reports);  //returns nothing 
     return reports.filter(r =>r.form === 'chv_quality_monitoring').length;

A patient_uuid or patient_id or place_id attribute links a report to a contact profile, regardless of the submitter. Therefore, your function should work correctly if the report is properly linked. However, if there is an error in the doc, "errors": [ ... ], due to some reason, it could be a source of the unexpected behavior.

1 Like

I added patient_id = chv_uuid in my doc and it worked.