I have a trigger call which returns results with an id value. I add to set it explicitly in the code as it wasn’t returned as the first attribute within each result. My code is as follows:
return z.request(options).then((response) => {
response.throwForStatus();
const results = response.json;
const downloads = results["downloads"].map((item) => {
return Object.assign(item, {
id: item["id"],
});
});
The problem however is that it appears that the id’s are not always unique, which then throws the API invalid response error:
“Got a two or more results with the id of...”
This is an example of a result:
{
"date_downloaded": "2022-05-18T14:42:55.145Z",
"id": "string",
"asset_type": "string",
"product_type": "string",
"thumb_uri": "string",
"agreement_name": "string",
"product_id": 0,
"download_details": {
"download_notes": "string",
"project_code": "string"
}
My question: how could I set the Zapier item id to be a combination of the result’s id AND date_downloaded values so that it is always unique?
Best answer by ikbelkirasan
View original