Checking current attempt on background actions

Hi guys, is it possible to check if the current background action is retrying? More specifically, I want some code to run only if the action fails and there's no retries left.
3 Replies
Chocci_Milk
Chocci_Milk7mo ago
Hello, You could take advantage of the trigger object from within the action to see what the current attempt is? As you can see there's the finalAttempt boolean!
{
"attemptNumber": 1,
"finalAttempt": false,
"id": "job-EnEY-4vrY9ZzIFgPLlnZj",
"mutationName": "createShopifyBulkOperation",
"priority": "default",
"rawParams": {
"backgroundOptions": {
"priority": "DEFAULT"
}
},
"rootAction": "bulk/createShopifyBulkOperation",
"type": "background-action"
}
{
"attemptNumber": 1,
"finalAttempt": false,
"id": "job-EnEY-4vrY9ZzIFgPLlnZj",
"mutationName": "createShopifyBulkOperation",
"priority": "default",
"rawParams": {
"backgroundOptions": {
"priority": "DEFAULT"
}
},
"rootAction": "bulk/createShopifyBulkOperation",
"type": "background-action"
}
RenanVSouza
RenanVSouzaOP7mo ago
Great, that works. Thanks!
Chocci_Milk
Chocci_Milk7mo ago
No problem!

Did you find this page helpful?