Transition error on mark_for_outbound while muting

Hello @diana

Whenever i fill out and submit a mute form on a patient i see

Errors
   Transition error on mark_for_outbound: Cannot read property 'message' of undefined

in report . What could it mean ? , not properly understanding the connection here between the outbound transition feature and the muting patient form

Hi @cliff

I suspect that this is related to your outbound config or the structure of the report.
Can you please share both?

not properly understanding the connection here between the outbound transition feature and the muting patient form

Both mark_for_outbound and muting are transitions that run over all documents.

thanks @diana these are the outbound configs i have

"outbound": {
    "patient triggers enroll workflow in Textit": {
      "relevant_to": "doc.type === 'person' && doc.tsis",
      "destination": {
        "base_url": "https://textit.in",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "rapidpro.app"
        },
        "path": "/api/v2/flow_starts.json"
      },
      "mapping": {
        "flow": {
          "expr": "'e16b6f2f-228b-4690-a52d-a29f54f88fc6'"
        },
        "urns": {
          "expr": "['tel:' + doc.phone]"
        }
      }
    },
    "message from Textit triggers this ": {
      "relevant_to": "doc.type === 'data_record' && doc.sms_message.message === 'this is the new content'",
      "destination": {
        "base_url": "https://textit.in",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "rapidpro.app"
        },
        "path": "/api/v2/flow_starts.json"
      },
      "mapping": {
        "flow": {
          "expr": "'efc8e336-c482-4c48-9c86-752e83824b4f1'"
        },
        "urns": {
          "expr": "['tel:' + doc.from]"
        }
      }
    }
  },

below is the muting configuration

"muting": {
    "mute_forms": [
      "mute"
    ],
    "unmute_forms": [
      "unmute"
    ],
    "validations": {
      "join_responses": true,
      "list": []
    },
    "messages": [
      {
        "translation_key": "",
        "event_type": "mute",
        "recipient": "reporting_unit"
      },
      {
        "translation_key": "",
        "event_type": "unmute",
        "recipient": "reporting_unit"
      },
      {
        "translation_key": "",
        "event_type": "already_muted",
        "recipient": "reporting_unit"
      }
    ]
  },

by the structure of the report do you mean the way it appears in the reports tab or the xlm structure ?

Hi @cliff

I think I see where the error is comming from:

"relevant_to": "doc.type === 'data_record' && doc.sms_message.message === 'this is the new content'",

Here you’re not checking whether doc.sms_message exists before accessing the message property.
Please try to change this to:

"relevant_to": "doc.type === 'data_record' && doc.sms_message && doc.sms_message.message === 'this is the new content'",
1 Like

thanks @diana :slightly_smiling_face: