Condition cards on contacts

Hello @marc @diana

Am using this conditional card configuration

{
    label: 'task.risk.status',
    appliesToType: 'report',
    appliesIf: function(r){
      console.log(r);
      return r.form === 'care';
    },
    fields: [
      {
        label: 'task.risk.category',
        value: function(r) {
          var risk = r.fields.care.category;
          return risk;
        },
        width: 12
      },
    ]
}

which displays the card as need for the contacts below


but at the same time displays the card under the facility below

I would like to inquire on how to restrict conditional cards to appear only on contacts profiles ?
Thanks

To have a card only appear on certain types of contacts you could check for the contact type in your appliesIf function.

That said, from your screenshots it seems as though the report is submitted for both the person and the place – is that intended? If you make it appear only where you want it, on the person’s profile, then you would also be solving the problem.

From the documentation:

Reports that have at least one of place_id , patient_id , and patient_uuid at the top level will be associated with that contact.

Since condition cards with appliesToType: 'report' can only appear on a contact when the form is submitted for that contact, making sure that the form isn’t incorrectly associated with contacts will make sure it doesn’t show up unexpectedly.

1 Like

yeah thanks @marc ,restricted the contact type ,works fine

1 Like

A post was split to a new topic: How to show single condition card instead of multiple on contacts