Date Search via Backend Workflow

I am calling a backend workflow via a webhook, passing in a date parameter. Using “search for” with constraints of o_date >= p_date:rounded down to day and o_date < p_date:+days 1:rounded down to date fails to find a record. However the same search via the front end using arbitrary p_date works fine.

I feel like I am missing something obvious. Has anyone else ran into this or have a work-around?
Log:


Frontend, date chosen by date picker

Backend, date from webhook. Date is being correctly parsed into the log object, but the search is returning blank. (such helpful logs)

**edited to correct screen shot, workflow uses :date"

Hi there, @andrew… total shot in the dark here, but have you tried checking the box to ignore privacy rules when running the backend workflow?

Best…
Mike

Hi Mike, just had the same thought and double checked. Ignore privacy rules is checked and no privacy roles are setup for the object in question. Thanks for the idea though

1 Like

Can you try a test?

Try to perform this same search (using the API) to find the record, but instead of use the right date, try to use two days before, one day before, one day after and two days after.

See if, in one these searches, you find the result.

That was a good idea to try. Just tried 2 days before - 2 days after. Same result date fails in backend. Thanks for the help.

Hummm…

The problem may be the “:rounded down to DAY”.
Try to use “:rounded down to DATE”

Yeah unfortunately date is what I am using. My screen shot was during rounds of testing ended up on :day. :date fails as well.

@andrew this is strange…

I think that we need to go step by step here…

Are you sure that the date is beeing passed correctly?

  • Create an endpoint (backend workflow) just to receive and save the received date into the database.
  • Pass the current date/time using this endpoint/webhook.
  • Check if the received date was saved correctly.

Yes, it is strange! I have already had the workflow receive and write the data to an object in a step previous to the search. I have even had the search use the saved object dates to make the search rather than the webhook parameters. The is being rec’d and parsed into a date correctly. Also, I have tested sending the webhook from my upstream app as well as a postman call. All fail the search.

So the issue is with the date parameter. If I write the date to the database first, it works. I thought I had carefully tested this and if failed before but I must have been mistaken. A workflow where it writes to the database, then uses the database data to perform the search works. But using the date param to do the search fails. Filing a bug report and moving on for now.

2 Likes

Nice to know!!