Connector error setting hours closed

I’m reading in hours data from an API and I’m having trouble setting the days the location is closed. When the store is open I’m able to set the hours successfully, but when the day has no hours data (since it’s closed), the connector sets the hours to 12am-12pm.

To avoid this I created another column (for each day) with a boolean which maps to Hours > Day > Is Closed. The logic for this column is that when the normal hours data is blank, set the new column to “true”, and map that to the Yext field. The data validation passes, but when I run the connector I get “ERROR: Value must have one of Open Intervals or Is Closed properties set.” This error only appears on entities where I’m trying to set the Is Closed property to true.

Here is an example JSON for my transform:
{
“addColumn”: {
“newColumnHeader”: “saturdayClosed”,
“columnValue”: “true”
},
“conditionalExecution”: {
“clause”: {
“boolOperator”: “AND”,
“conditions”: [
{
“inputColumn”: “locationHours.saturdayRanges”,
“comparator”: “IS_BLANK”
}
]
}
}
},

Account link: https://sandbox.yext.com/s/3255279/addData/connectors/13871

Let me know if I’m doing something wrong!

Hi Michael,

The hours field is very complex, and we actively developing an easier way to map to each day.

Until then, the reason you are receiving the validation error is likely because you are not explicitly CLEARING the openIntervals field.

What you’ll need to do is add logic to your Mappings on OpenInvertals to set ClearIfBlank=True.
Without that setting, the openIntervals still “exist” and hence why marking it as Closed fails (since a day can’t be closed and open at the same time).

I’d recommend having ClearIfBlank=true for ALL hours fields mappings to ensure there are no issues.

Again, we know this is extremely confusing and should have a simple way to map to hours fields very soon :slight_smile: .

Let us know if you have any questions.

Best,
Rachel

Thanks for the quick response! I tried setting all the Open Intervals and Is Closed mappings to clearValueIfBlank, but I got the same set of errors

Here is the JSON if that helps:

{
  "header": "sundayEnd",
  "field": "hours",
  "subfieldPath": [
    {
      "name": "sunday"
    },
    {
      "name": "openIntervals"
    },
    {
      "name": "end"
    }
  ],
  "clearValueIfBlank": true
},


{
  "header": "sundayClosed",
  "field": "hours",
  "subfieldPath": [
    {
      "name": "sunday"
    },
    {
      "name": "isClosed"
    }
  ],
  "clearValueIfBlank": true
},

Ahh so you’ll also need to make the open Intervals actually be Blank (not 00:00-00:00) in order to accurately populate it.

You could add a transform that Finds And Replaces 00:00 to be blank if both columns have that value! That should solve it

That worked, thanks!