Attachment API - param to filter data based on time range.

Adithya Khurana
Tera Contributor

AdithyaKhurana_0-1696601875797.png


Attachment API - what is the api param to filter data based on time range  for attachments. I tried sysparm_query :  sys_created_on>=2022-01-01&sys_created_on<=2022-12-31. 
but not working

 

1 REPLY 1

Hemanth M1
Giga Sage
Giga Sage

Hi @Adithya Khurana ,

 

yes its "sysparm_query" but you need pass the encoded query

 Ex: created between 10/6 to 10/7 i.e "sys_created_onBETWEENjavascript&colon;gs.dateGenerate('2023-10-06','00:00:00')@javascript&colon;gs.endOfToday()"

 

go to sys_attachment table and apply filter and copy the encoded query. i did test this in Rest API explorer and its working fine.

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025