Skip to content

Glue Salesforce Connector and Date Filters

0

I started by following the advice in this post: https://repost.aws/questions/QUCUoBG9fTRQOJ9TWHT60wzg/aws-glue-salesforce-connector-filter-data-from-object But it is not working.
If I do a date like ClosedDate=2024-12-01 I get an ArithmeticBinaryContext is not supported error. If I do a date like ClosedDate='2024-12-01T00:00:00Z' I get this error: Text '"2024-12-01T00:00:00Z"' could not be parsed at index 0.

This is an example of the filter predicate: "FILTER_PREDICATE": "Status='Closed' AND ClosedDate='2024-12-01T00:00:00Z'"

I'm using the Glue Visual ETL, if I convert it to script, I still get the same error.

I've tried to change the format for different ways, like 2024/12/01 to try and force a different parse of the string, but nothing. If I remove the date filter it works, but that is way too much data.

asked 2 years ago434 views

3 Answers
1

The issue you're experiencing with date filters in the AWS Glue Salesforce Connector is likely due to the specific format requirements for DateTime fields when using filters. For Salesforce Marketing Cloud connector (which may have similar requirements to the standard Salesforce connector), the correct format for DateTime fields in filters is "yyyy-mm-ddThh:MM:ssZ".

However, it seems you've already tried this format and encountered an error. Given that, here are a few suggestions to troubleshoot and resolve the issue:

  1. Ensure that you're using single quotes around the date string in your filter predicate. Your example looks correct, but double-check this.

  2. Try removing the time component and just use the date part: "FILTER_PREDICATE": "Status='Closed' AND ClosedDate = 2024-12-01"

  3. If that doesn't work, you could try using a range instead of an exact date: "FILTER_PREDICATE": "Status='Closed' AND ClosedDate >= 2024-12-01 AND ClosedDate < 2024-12-02"

  4. Another approach is to use Salesforce's date literals. For example: "FILTER_PREDICATE": "Status='Closed' AND ClosedDate = THIS_YEAR"

  5. If you're trying to filter for a specific year, you could use the CALENDAR_YEAR() function: "FILTER_PREDICATE": "Status='Closed' AND CALENDAR_YEAR(ClosedDate) = 2024"

  6. Lastly, you might want to check if the ClosedDate field in your Salesforce object is actually a DateTime field. If it's a Date field without a time component, that could explain some of the parsing issues.

If none of these solutions work, you may need to contact AWS support for further assistance, as there could be a specific issue with how the Glue Salesforce Connector is handling date filters in your particular setup.

Remember that when working with AWS Glue's Salesforce connector, it's crucial to use the correct field names as they appear in Salesforce, respecting case sensitivity. The connector translates your filter predicate into a SOQL query, so adhering to Salesforce's naming conventions is essential for successful data extraction and filtering.
Sources
AWS Glue: Salesforce connector. Filter data from object | AWS re:Post
Limitations and notes for Salesforce Marketing Cloud connector - AWS Glue

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Here are all the variations and failure modes: Status='Closed' AND CALENDAR_YEAR(ClosedDate) = 2024 glue.spark.connector.exception.ValidationException: FunctionCallContext is not supported

Status='Closed' AND ClosedDate = 2024-12-01 ArithmeticBinaryContext is not supported.

Status='Closed' AND ClosedDate >= 2024-12-01 AND ClosedDate < 2024-12-02 ArithmeticBinaryContext is not supported.

Status='Closed' AND ClosedDate >= '2024-12-01' AND ClosedDate < '2024-12-02' Text '"2024-12-01"' could not be parsed at index 0

Status='Closed' AND ClosedDate = THIS_YEAR no viable alternative at input 'ClosedDate=THIS_YEAR' at com.amazonaws.appflow.custom.connector.queryfilter.CustomConnectorParseTreeBuilder

answered 2 years ago

0

In the Salesforce connector, try using the following syntax for the filter:

where LastModifiedDate > TIMESTAMP '2025-05-05 00:00:00 UTC'

I was able to test this using my SFDC developer account and the CASE entity/table.

Hope this helps!

AWS

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.