Does object named properties conflict with contract output?

Hi all,

I have a query, I hope you can help me since I have not found information about it.

Inside the association of my response (output) is my JSON:

{
"full": 1,
"results": [
{
"id": "xx",
"properties": {
"createdate": "xxxx-xx-xxT18:12:35.647Z",
"email": "xx@xxx.com",
"firstname": "xxx",
"hs_object_id": "xxx",
"lastmodifieddate": "xxxx-xx-xxT18:12:35.647Z",
"lastname": "xxxx"
},
"createdAt": "2022-03-30T20:16:19.625Z",
"updatedAt": "2023-01-16T18:12:35.647Z",
"archived": false
}
]
}

and the contract my output is:

output: {
   "successSchema": {
     "type": "object",
     "properties": {
       "results": {
         "type": "array",
         "items": {
           "type": "object",
           "properties": {
             "properties": {
               "type": "object",
               "properties": {
                 "email": {
                   "type": "string"
                 }
               },
               "additionalProperties": true
             }
           },
           "additionalProperties": true
         }
       }
     },
     "additionalProperties": true
   }
 }

The response is OK, but the result of the information does not show it. Is it possible that because the object has name properties, the result is not displayed?

Thanks in advance!

#Integrations

Regards.

Camilo

Hi Camilo,

I reproduced the issue, but I am not quite sure if it is a bug or a limitation of "flattening" the object. Please open a support case so that this can be researched / prioritized / fixed.

--Jason

1 Like

Thanks Jason, I appreciate your answer

Hello,

As a note, if you are trying to retrieve only the list/array of emails from your result, you can also use the following to avoid the issue with "properties" attribute name.

Your Output Contract can be set like this:

{
  "type": "object",
  "properties": {
    "emailList": {
      "type": "array",
      "items": {
        "title": "Item 1",
        "type": "string"
      }
    }
  },
  "additionalProperties": true
}

And your Response Configuration like this:

{
  "translationMap": {
    "values": "$.results[*].properties.email"
  },
  "translationMapDefaults": {
    "values": "[]"
  },
  "successTemplate": "{ \"emailList\": ${values} }"
}

Regards,

I am starting to think that this is a bug in the test mode UI, not in the actual data action behavior. Could you see if your action works correctly in the end tool, like architect?

--Jason

So this is a known issue, PCADMIN-7745. The test UI doesn't correctly handle having an object named "properties" in the results. I expect that means that your action was working, just not showing correct results in test mode. I noted that another customer had run into this issue on the ticket.

--Jason

1 Like

Hi Jason, I have used the data action in architect but the output variables of the action do not appear

Thank you for letting me know that this is also an issue with Architect, that got me to look in the right direction and find the underlying problem. I have opened up a ticket for an issue in the backend service, BPIVR-2719.

In order to get your data action working I would recommend going with Jerome's approach to avoid having a "properties" object inside of your output schema.

--Jason

I just merged in a fix for this issue. Unless we run into any issues it should be deployed globally in the next couple of weeks.

Thank you for reporting this issue!

--Jason

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.