Need new and updated Products data

Recently we have integrated with SangamCRM to fetch product information and use it for our internal purposes. There is a CRON scheduler which runs on a daily basis and pull products data from SangamCRM for the products created on previous day. below is the body parameter

{
“rest_data”: {
“assigned_user_id”: “”,
“multi_initial_filter”: ,
“favorite”: false,
“save_search”: false,
“save_search_id”: null,
“query”: “DATE(product_masters.created_at) >= ‘2025-01-08’”,
“advance_search”: false,
“sort”: “updated_at”,
“max_result”: 10,
“advance_search_json”: null,
“name_value_list”: {
“select_fields”: [
“module”,
“name”,
“internal_product_name_c”,
“stock_c”,
“manufacturer_c”,
“sub_category”,
“updated_at”,
“created_at”,
“status”
]
},
“module_name”: “ProductMaster”,
“order_by”: “desc”
}
}

Now the requirement is I need products that are created/updated on the previous day. Can you let me know what is to be changed in “query” part
I tried something like this and it is throwing error

“query”: "DATE(product_masters.created_at) >= ‘2025-01-28’ or DATE(product_masters.updated_at) >= ‘2025-01-28’ "

Please look into it

Hello,

We appreciate your work, sir.
Currently, some corrections are required, please use empty string quotes (“”)instead of null.
Secondly, you can use the provided query in your request to get your requirements.

“query”: “DATE(product_masters.created_at) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) OR DATE(product_masters.updated_at) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)”,

whole request:

{
	"rest_data": {
		"module_name": "ProductMaster",
		"assigned_user_id": "",
		"multi_initial_filter": "",
        "order_by": "DESC",
		"favorite": false,
		"save_search": false,
		"save_search_id": "",
		"query": "DATE(product_masters.created_at) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) OR DATE(product_masters.updated_at) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)",
		"advance_search": false,
		"sort": "updated_at",
		"max_result": 10,
		"advance_search_json": "",
		"name_value_list": {
			"select_fields": [
				"module",
				"name",
				"internal_product_name_c",
				"stock_c",
				"manufacturer_c",
				"sub_category",
				"updated_at",
				"created_at",
				"status"
			]
		}
	}
}

Please try this once, and let us know if this solves your query.

1 Like

Thanks Aayush,

I will try with this code and get back if anything else is required

3 Likes