Read Outgoing Referral Detail
Purpose: Read one eClinicalWorks Outgoing referral popup and return its parsed referral record. Use when: A specific referral is already identified and both referral_id and patient_id are available; this reads one popup, not referral search or edits. Inputs: referral_id:string and patient_id:string are required; referral_id should come from ecw_list_outgoing_referrals. encounter_id and request_id are optional strings; blank values are omitted. query_params is an optional JSON object, JSON-encoded object, or blank, with only these case-sensitive keys: ptName, referral360id, extNHXRefTxId, nhxMsgTxId, isReferralDeclined, recType, referralType, callingFrom, refSubType. Values must be strings, numbers, or booleans. The action maps IDs to refId/patientId and, when present, refEncId/nNhxReqId. Outputs: JSON object with success:boolean, error:string|null, notes/clinical_notes/to_facility_name/to_provider_name/status/sub_status_id:string|null, record:flat tag-to-string map|null, and duplicate_tags:string[]. On success the six convenience fields are strings (possibly empty), record contains the selected record's leaf tags, and duplicate tag names appear once while record keeps the first value. On failure the six fields and record are null and duplicate_tags is []. Success: success=true and error=null means ECW returned one parsable referral record; empty convenience strings mean their tags were absent or blank. Failure: success=false and error contains a fixed safe message for invalid input or organization, or an ECW read/parse failure. No record is established. Missing/blank required IDs and invalid query_params are rejected before ECW traffic; read failures can happen after the request. Correct input or organization/session issues before retrying. Effects: Read-only ECW popup GET through the existing authorized organization session; no write occurs. query_params (including ptName) and returned notes/clinical text may contain PHI. Inputs are trace-redacted; PHI values and exception text are not logged. Route outputs only to an authorized caller. Examples: {"referral_id":"r1","patient_id":"p1"} -> {"success":true,"error":null,"notes":"","clinical_notes":"","to_facility_name":"","to_provider_name":"","status":"","sub_status_id":"","record":{"referralId":"r1"},"duplicate_tags":[]}; missing referral_id -> {"success":false,"error":"referral_id is required","notes":null,"clinical_notes":null,"to_facility_name":null,"to_provider_name":null,"status":null,"sub_status_id":null,"record":null,"duplicate_tags":[]}.
ecw_read_outgoing_referral_detailUse in a workflow
Copy the discovered node config and fill its params from the input contract. Validate the complete graph before publishing. Integration results use {{node_id.default.field}}. Check business success before dependent writes; completion alone does not prove success.
{
"_group": "eClinicalWorks",
"params": {},
"handler": "ecw_read_outgoing_referral_detail"
}Inputs
- Referral Id
referral_idtextrequiredRequired text value.
- Patient Id
patient_idtextrequiredRequired text value.
- Encounter Id
encounter_idtextOptional text value.
- Request Id
request_idtextOptional text value.
- Query Params
query_paramsjsonOptional. Omit it, pass null, or pass a blank string for no extra popup parameters. Otherwise pass an object or a JSON-encoded string that parses to an object. Allowed case-sensitive keys: callingFrom, extNHXRefTxId, isReferralDeclined, nhxMsgTxId, ptName, recType, refSubType, referral360id, referralType. Each value must be a string, number, or boolean; null values, arrays, nested objects, unknown keys, malformed JSON, and JSON strings that decode to non-objects are rejected before ECW traffic. The encoded form is parsed and checked against the same key and scalar-value rules.
Outputs
successSuccesserrorErrornotesNotesclinical_notesClinical Notesto_facility_nameTo Facility Nameto_provider_nameTo Provider NamestatusStatussub_status_idSub Status IdrecordRecordduplicate_tagsDuplicate Tags
Output schema completeness: reviewed_partial
Safety
- External effect
- read
- Confirmation recommended
- No
- Retry safe
- Yes
- Dry run supported
- No
Schemas
These schemas are first-pass authoring guidance. Runtime validation remains authoritative.
Input schema
{
"type": "object",
"required": [
"referral_id",
"patient_id"
],
"properties": {
"patient_id": {
"type": "string",
"description": "Required text value.",
"x-workflow-field-type": "text"
},
"request_id": {
"type": "string",
"description": "Optional text value.",
"x-workflow-field-type": "text"
},
"referral_id": {
"type": "string",
"description": "Required text value.",
"x-workflow-field-type": "text"
},
"encounter_id": {
"type": "string",
"description": "Optional text value.",
"x-workflow-field-type": "text"
},
"query_params": {
"anyOf": [
{
"type": "object",
"properties": {
"ptName": {
"type": [
"string",
"number",
"boolean"
]
},
"recType": {
"type": [
"string",
"number",
"boolean"
]
},
"nhxMsgTxId": {
"type": [
"string",
"number",
"boolean"
]
},
"refSubType": {
"type": [
"string",
"number",
"boolean"
]
},
"callingFrom": {
"type": [
"string",
"number",
"boolean"
]
},
"referralType": {
"type": [
"string",
"number",
"boolean"
]
},
"extNHXRefTxId": {
"type": [
"string",
"number",
"boolean"
]
},
"referral360id": {
"type": [
"string",
"number",
"boolean"
]
},
"isReferralDeclined": {
"type": [
"string",
"number",
"boolean"
]
}
},
"additionalProperties": false
},
{
"type": "string",
"anyOf": [
{
"pattern": "^\\s*$"
},
{
"contentSchema": {
"type": "object",
"properties": {
"ptName": {
"type": [
"string",
"number",
"boolean"
]
},
"recType": {
"type": [
"string",
"number",
"boolean"
]
},
"nhxMsgTxId": {
"type": [
"string",
"number",
"boolean"
]
},
"refSubType": {
"type": [
"string",
"number",
"boolean"
]
},
"callingFrom": {
"type": [
"string",
"number",
"boolean"
]
},
"referralType": {
"type": [
"string",
"number",
"boolean"
]
},
"extNHXRefTxId": {
"type": [
"string",
"number",
"boolean"
]
},
"referral360id": {
"type": [
"string",
"number",
"boolean"
]
},
"isReferralDeclined": {
"type": [
"string",
"number",
"boolean"
]
}
},
"additionalProperties": false
},
"contentMediaType": "application/json"
}
]
},
{
"type": "null"
}
],
"description": "Optional. Omit it, pass null, or pass a blank string for no extra popup parameters. Otherwise pass an object or a JSON-encoded string that parses to an object. Allowed case-sensitive keys: callingFrom, extNHXRefTxId, isReferralDeclined, nhxMsgTxId, ptName, recType, refSubType, referral360id, referralType. Each value must be a string, number, or boolean; null values, arrays, nested objects, unknown keys, malformed JSON, and JSON strings that decode to non-objects are rejected before ECW traffic. The encoded form is parsed and checked against the same key and scalar-value rules.",
"x-workflow-field-type": "json"
}
},
"additionalProperties": false
}Output schema
{
"type": "object",
"properties": {
"error": {
"type": [
"string",
"null"
]
},
"notes": {},
"record": {},
"status": {},
"success": {
"type": "boolean"
},
"sub_status_id": {},
"clinical_notes": {},
"duplicate_tags": {},
"to_facility_name": {},
"to_provider_name": {}
},
"additionalProperties": true
}