Untitled
unknown
plain_text
2 years ago
2.0 kB
12
Indexable
const entity = {
"id": 234675,
"connectionId": "18111349-c703-43b5-a161-b955c6d8d3d1",
"connectionLabel": "H&M Production",
"campaignId": 63256,
"campaignIdentifier": "OP103507",
"campaign": "E_20231012_GBL_S8W41_THU_FF_KIDSANDFAMILY",
"workflowId": null,
"workflowIdentifier": null,
"workflow": null,
"identifier": "DM1711087",
"label": "E_20231012_GBL_S8W41_THU_FF_KIDSANDFAMILY sr_RS",
"deliveryState": "Being edited",
"targetState": "Being edited",
"contentState": "Being edited",
"analysisState": "Being edited",
"dispatchDate": "2023-10-12T10:00:00",
"targeted": 0,
"sent": 0,
"delivered": 0,
"optOuts": 0,
"uniqueOpens": 0,
"uniqueClicks": 0,
"refused": 0,
"unreachable": 0,
"invalidDomain": 0,
"notConnected": 0,
"disabled": 0,
"unknownUser": 0,
"error": 0,
"isDeliverySent": false,
"validFrom": "2023-10-09T08:31:41.38",
"validTo": "9999-12-31T23:59:59.99",
"messageType": "Email",
"mailboxFull": 0,
"newQuarantine": 0,
"errorPending": 0,
"errorSum": 0,
"reject": 0,
"type": 0,
"lastUpdate": "2023-10-09T08:31:41.4514297+00:00",
"deliveryVisuals": null
}
//GBL Current time at least 3 hours past dispatch time and status is not Ready to be Delivered
const deliveryLabel = entity.label.includes("GBL") // E_20231012_GBL_S8W41_THU_FF_KIDSANDFAMILY sr_RS
const deliveryStatus = entity.deliveryState // Being edited
const dispatchTime = entity.dispatchDate
const currentTime = new Date();
const parsedTime = currentTime.getDate.parse()
console.log(Math.abs(dispatchTime - currentTime) / 36e5)
console.log("Current Time: " + currentTime)
console.log("Dispatch Time: " + dispatchTime)
if (deliveryStatus != "Ready to be Delivered" && deliveryLabel) {
console.log("if")
return true
} else {
return false
}
Editor is loading...