1

I am using external service for making a getting call and getting results in JSON from a AZURE server. The results are coming back correctly into salesforce by using external service where i imported the swagger openapi spec and created widget with no code, but i get the below error when the results are trying to get parsed with external service

Error element GetTradeDetails (FlowActionCall).
Unable to map response for output parameter 200 of invocable action StepExt.getApiV4StepMatchingEngineGetTradeDetails. Received response: 
{
  "trade_request_vin": "Testvin2 ",
  "trade_request_date": "2017-01-01T00:00:00",
  "trade_request_transaction_id": "Tran#12345",
  "trade_request_matchid": "Match#123",
  "trade_request_matchedamount": 2001,
  "trade_request_taxableamount": 457.9,
  "trade_confirmation_date": "2017-01-09T00:00:00",
  "expected_lease_date": "2017-01-03T00:00:00",
  "titling_state": "GA",
  "trade_request_vehicle_make": "Make#44",
  "trade_request_vehicle_model": "Model#657",
  "trade_request_vehicle_year": "202",
  "lessee_street_address": "St 12345",
  "lessee_city": "Atlanta",
  "lessee_state": "GA",
  "lessee_zip": "30350",
  "dealership_street_address": "St 456789",
  "dealership_city": "Atlanta",
  "dealership_state": "GA",
  "dealership_zip": "30360",
  "rebate_amount": 2999.99,
  "trade_vehicle_color": "Black",
  "lease_term_in_months": 60,
  "trade_vehicle_odometer": 13,
  "retail_tradein_vin": "VIN12345678901235",
  "retail_tradein_amount": 52999.99,
  "lease_turnin_vin": "VIN12345678901290",
  "lease_turnin_payoff": 500.12,
  "previous_lease_account_number": "ACC123456789",
  "trade_matched_sales": [
    {
      "unit_number": "A1234567890",
      "vin": "salevin1",
      "amount": 2001,
      "make": "Make#1",
      "model": "Model#1",
      "year": "2017",
      "domicile_state": "GA",
      "odometer": 23922
    }
  ]
}

Even though the results are correct and as per the open api spec file which has the format below

"/api/v4/STEP/MatchingEngine/GetTradeDetails": {
      "summary": "Provides the trade details for a trade",
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TradeDetails"
                }
              }
            },
            "description": "Returns the trade details for a trade"
          },
          "204": {
            "description": "Returns 204 response code when there is no data to send back"
          },
          "400": {
            "description": "Returns 400 response code when invalid request is passed or any mandatory values are missing in request"
          },
          "401": {
            "description": "Returns 401 when an invalid Authorization header is passed in request"
          },
          "500": {
            "description": "Returns 500 response code when a technical exception occurs during request."
          }
        },
        "summary": "GetTradeDetails",
        "description": "Provides the trade details for a trade"
      },
      "parameters": [
        {
          "name": "trade_transaction_id",
          "description": "Trade transaction id.",
          "schema": {
            "type": "string"
          },
          "in": "query",
          "required": true
        },
        {
          "name": "trade_vin",
          "description": "Purchase vehicle VIN.",
          "schema": {
            "type": "string"
          },
          "in": "query",
          "required": true
        }
      ]
    },
"TradeDetails": {
        "title": "Root Type for TradeDetails",
        "description": "Trade Vehicles data",
        "type": "object",
        "example": {
          "trade_request_vin": "VIN12345678901234",
          "trade_request_date": "2017-01-09",
          "trade_request_transaction_id": "Tran#12345",
          "trade_request_matchid": "Match#123",
          "trade_request_matchedamount": 52771.03,
          "trade_request_taxableamount": 228.96,
          "trade_confirmation_date": "2017-01-09",
          "expected_lease_date": "2017-01-03",
          "titling_state": "GA",
          "trade_request_vehicle_make": "Make#44",
          "trade_request_vehicle_model": "Model#657",
          "trade_request_vehicle_year": "202",
          "lessee_street_address": "St 12345",
          "lessee_city": "Atlanta",
          "lessee_state": "GA",
          "lessee_zip": "30350",
          "dealership_street_address": "St 456789",
          "dealership_city": "Atlanta",
          "dealership_state": "GA",
          "dealership_zip": "30360",
          "rebate_amount": 2999.99,
          "trade_vehicle_color": "Black",
          "lease_term_in_months": 60,
          "trade_vehicle_odometer": 13,
          "retail_tradein_vin": "VIN12345678901235",
          "retail_tradein_amount": 52999.99,
          "lease_turnin_vin": "VIN12345678901236",
          "lease_turnin_payoff": 500.12,
          "previous_lease_account_number": "ACC123456789",
          "trade_matched_sales": [
            {
              "unit_number": "A1234567890",
              "vin": "salevin1",
              "amount": 12850.12,
              "make": "Make#1",
              "model": "Model#1",
              "year": "2017",
              "domicile_state": "GA",
              "odometer": 23922
            },
            {
              "unit_number": "M1w676289",
              "vin": "salevin2",
              "amount": 21920.89,
              "make": "Make2",
              "model": "Model#2",
              "year": "2016",
              "domicile_state": "NC",
              "odometer": 19359
            },
            {
              "unit_number": "C46sd5590",
              "vin": "salevin3",
              "amount": 18000.02,
              "make": "Make#1",
              "model": "Model#33",
              "year": "2017",
              "domicile_state": "TN",
              "odometer": 1459
            }
          ]
        },
        "properties": {
          "trade_request_vin": {
            "type": "string"
          },
          "trade_request_date": {
            "format": "date",
            "type": "string"
          },
          "trade_request_transaction_id": {
            "type": "string"
          },
          "trade_request_matchid": {
            "type": "string"
          },
          "trade_request_matchedamount": {
            "format": "double",
            "type": "number"
          },
          "trade_request_taxableamount": {
            "format": "double",
            "type": "number"
          },
          "trade_confirmation_date": {
            "format": "date",
            "type": "string"
          },
          "expected_lease_date": {
            "format": "date",
            "type": "string"
          },
          "titling_state": {
            "type": "string"
          },
          "trade_request_vehicle_make": {
            "type": "string"
          },
          "trade_request_vehicle_model": {
            "type": "string"
          },
          "trade_request_vehicle_year": {
            "type": "string"
          },
          "lessee_street_address": {
            "type": "string"
          },
          "lessee_city": {
            "type": "string"
          },
          "lessee_state": {
            "type": "string"
          },
          "lessee_zip": {
            "type": "string"
          },
          "dealership_street_address": {
            "type": "string"
          },
          "dealership_city": {
            "type": "string"
          },
          "dealership_state": {
            "type": "string"
          },
          "dealership_zip": {
            "type": "string"
          },
          "rebate_amount": {
            "format": "double",
            "type": "number"
          },
          "trade_vehicle_color": {
            "type": "string"
          },
          "lease_term_in_months": {
            "format": "int32",
            "type": "integer"
          },
          "trade_vehicle_odometer": {
            "format": "int32",
            "type": "integer"
          },
          "retail_tradein_vin": {
            "type": "string"
          },
          "retail_tradein_amount": {
            "format": "double",
            "type": "number"
          },
          "lease_turnin_vin": {
            "type": "string"
          },
          "lease_turnin_payoff": {
            "format": "double",
            "type": "number"
          },
          "previous_lease_account_number": {
            "type": "string"
          },
          "trade_matched_sales": {
            "type": "array",
            "uniqueItems": true,
            "minItems": 1,
            "items": {
              "type": "object",
              "properties": {
                "unit_number": {
                  "type": "string"
                },
                "vin": {
                  "type": "string"
                },
                "amount": {
                  "format": "double",
                  "type": "number"
                },
                "make": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "year": {
                  "type": "string"
                },
                "domicile_state": {
                  "type": "string"
                },
                "odometer": {
                  "format": "double",
                  "type": "number"
                }
              }
            }
          }
        }
      },

I am not getting a problem for the api's where the properties or variables don't contain a special character like '-' or '_'. If there is any special character in the variables like 'trade_request_vin' which is in the spec file, i get a parsing error but if there is no special character in name there is no parsing error

In the doc here its mentioned that reserved characters are encoded and decoded with UTF8 by default but the parsing fails when there is special characters. Has someone faced this problem? how did you solve this problem? i was trying to play around with the swagger file to see if i can change the default behavior of encoding but couldnt see any method

1 Answer 1

1

My assumption was wrong, the parsing error was not because of the underscore(_) and it was due to the date format being incorrect. In the spec file it was mentioned as "trade_request_date": "2017-01-09" but in actual response i got "trade_request_date": "2017-01-01T00:00:00" which created the error during parsing.

My guess on why it was a problem to debug this was because the error message was too generic Unable to map response for output parameter 200 of invocable action without telling me any detail on what that parsing error was. Imagine i have 300 fields for parsing and there is an error with one field, we need to analyze outside of salesforce on which field has the parsing error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .