0

I've created a flow to utilize an External Service, however, the flow appears to be returning a null object response despite the 200 status code. In addition, the flow doesn't seem to allow me to view any of the properties of the class that was created. Is there an issue in my schema or is there something going on here?

The Schema is defined below

{
  "swagger": "2.0",
  "info": {
    "title": "Test",
    "description": "API description in Markdown.",
    "version": "1.0.0"
  },
  "host": "api.*******.com",
  "basePath": "/api/v1",
  "schemes": [
    "https"
  ],
    "definitions": {
    "merchant": {
      "type":"object",
      "properties":{  
            "fein":{    
                  "type":"string"
            },
            "legal_name":{    
                  "type":"string"
            },
            "dba":{    
                  "type":"string"
            },
           ...
            "notes":{
                "type":"array",
                "items":{
                      "type":  "object",
                      "$ref":  "#/definitions/note"
                }
            }
      }
    },
    "note":{
        "type":"object",
        "properties":{
            "category":{
                "type":"string"
            },
            "note":{
                "type":"string"
            },
            "created_at":{
                "type":"string"
            },
            "added_by":{
                "type":"string"
            }
        }
    }
  },
  "paths": {
    "/merchants/{fein}": {
      "get": {
        "summary": "Search for a merchant.",
        "produces":[
          "application/json"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "fein",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "array",
              "items":{
                "type": "object",
                "properties": {
                  "$ref": "#/definitions/merchant"
                }
              }

            }
          }
        }
      }
    }
  }
}

The output JSON should look like the following.

[
  {
    "merchant": {
      "fein": "01-2345678",
      "legal_name": "ACME Company",
      "dba": "ACME",
      "address": "123 First Ave. S.",
      "street1": "",
      "street2": "",
      "city": "Los Angeles",
      "state": "CA",
      "business_phone": "123-456-7890",
      "business_startdate": "1/1/1985",
      "industry": "Combustables",
      "notes": [
        {
          "note": {
            "category": "Slow Pay",
            "note": "Merchant is a slow pay and/or default account.",
            "created_at": "2015-09-01 04:21:41 UTC",
            "added_by": "XYZ Funder"
          }
        }
      ]
    }
  }
]

The flow debug details are:

DATAMERCH.GETMERCHANTSBYFEIN (EXTERNAL SERVICES): LookupFEIN

Inputs: fein = {!TaxID} (1234567)

Outputs: 200 ([DataMerch_getMerchantsByFein_OUT_200:[x24ref=null]])

However, when checking the developer debug log the response to be valid and did populate some valuesdebug output

ExternalServiceSchemaType:OpenApi|ExternalServiceName:DataMerch|SystemVersion:2|Action:GET|InputParameters:{"fein":"\"*******\""}
ExternalServiceSchemaType:OpenApi|ExternalServiceName:DataMerch|SystemVersion:2|Action:GET|OutputParameters:{"200":"[{\"merchant\":{\"fein\":\"**-*******\",\"legal_name\":\"[REDACTED]\",\"dba\":\"\",\"address\":null,\"street1\":null,\"street2\":null,\"city\":\"MARIETTA\",\"state\":\"GA\",\"business_phone <... truncated: 247 characters ...>
  • Make sure you are using Enhanced External Services in Salesforce. If not activate that and then create a new Named Credential and External Service. Also check the limitations in Salesforce for this. Even with a valid schema there are a few parameters that Salesforce doesn't accept. – ddeve May 19 at 20:14
  • Enhanced External Services is enabled, and the service was created with it enabled. – Dan May 19 at 20:50
  • Did you try post instead of get? We got this to work few weeks ago but had to do a lot of fiddling, and open a case despite api working on it's own – ddeve May 19 at 22:37
  • while the API defines this call as GET request, i attempted to do it as POST, per youir recommendation, the result is there is no response, (not even a null object) – Dan May 19 at 22:56
  • There is a Known Issue dealing with hyphens in the Path statement. Those are often more expansive than initially written. It's not fixed until Summer '20. I see your output for FEIN has a hyphen so may want to see what happens if you remove that output var from schema as a test here I submitted the other KI for Apex reserved words but doesn't look like you have any of those. – ddeve May 20 at 0:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.