Using OData Query for Get Form Tasks

I need help writing an OData query that checks for tasks that have a completed status, are not deleted, and have a LastModifiedDate after a datetime variable I will create.

This works: “Status eq ‘Completed’ and IsDeleted eq false”

All of these are giving me an error:
“Status eq ‘Completed’ and IsDeleted eq false and LastModificationTime gt 2022-11-02T00:00:00”
“Status eq ‘Completed’ and IsDeleted eq false and LastModificationTime gt ‘2022-11-02T00:00:00’”
“Status eq ‘Completed’ and IsDeleted eq false and LastModificationTime gt DateTime’2022-11-02T00:00:00’”
“Status eq ‘Completed’ and IsDeleted eq false and LastModificationTime gt ‘11/02/2022 00:00:00’”

Can anyone help provide the OData syntax I need to use for the LastModificationTime?

Also, does anyone have a good resource for writing OData queries? I am having a hard time finding things online to use to help me. I’d like to bookmark it for future reference.

1 Like

Hi @kaitlyn.snyder

As per Odata query you can try using day(), month(), year(), hour(), minute(), second() to get idividual values and then use gt or lt

Eg: day(datetime) gt 6

cheers

How would I format that within the filter?

Like: "Status eq ‘Completed’ and IsDeleted eq false and day(LastModificationTime) gt X and month(LastModificationTime) gt X and year(LastModificationTime) gt X … etc?

Hi @kaitlyn.snyder

yes thats the way you can try…extract those from your date on right side as well. This is the way we used on sp.

Hope this works

Cheers

Hmm. Okay, that did allow the query to go through but now it seems to be ignoring the Status eq ‘Completed’ piece.

Here was the full query it created:
Filter Query: Status eq ‘Completed’ and IsDeleted eq false and (day(LastModificationTime) gt 02 and month(LastModificationTime) gt 11 and year(LastModificationTime) gt 2022 and hour(LastModificationTime) gt 00 and minute(LastModificationTime) gt 00 and second(LastModificationTime) gt 00)

Here’s a screenshot of the list of task data it returned, including several that have not been assigned or are not set to completed:

Hi @kaitlyn.snyder

Try adding status/Value pe Status\Value instead of status. As it looks like a selection or drop down.

Cheers

It is still returning 14 items and I am only expecting 3.

I did figure a way to filter the LatestModificationTime after retrieving the items. I may just move forward with that if I can’t get this to work out.

Oh my gosh, ignore my last few comments. I forgot to feed the filter back into the GetFormTask activity after using an assign to create the date format pieces.

This is working now. Thank you!

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