Feb 28, 2023 08:54 AM
Hi All,
I'm wondering if there is a way to get an automation's name from within the automation.
I'm working on a better error handling system for collaborative bases. When automations fail, they currently only send a notification to a single user - the person who turned the automation on or updated it last. I need multiple people to be informed in a non-arbitrary way should any one of the developers be out.
I currently have something that looks like this:
output.set("update_status","success");
let buildErrMsg = function(automationName, description, name ){
let msg = description + " in " + automationName + ".\n\n" + "Failed with error: " + name
return(msg)
}
try{
await table.updateRecordsAsync(recordsToUpdate)
}catch(err){
err.description = "Issue with updateRecordsAsync";
err.automationName = "My Automation"
let msg = buildErrMsg(err.automationName,err.description, err.name)
output.set("update_status",msg);
}
The output variable is then used to send a slack message to the team handling base development.
Ideally, the `automationName` variable could be dynamically assigned based on the current automation.
Solved! Go to Solution.
Feb 28, 2023 09:13 AM
Scripting does not have access to the automation name. You can add input variables for the automation name and url so that you do not have to hardcode them into your script. Set the input variables when you configure the automation, and reference the input variables inside the script.
Feb 28, 2023 09:13 AM
Scripting does not have access to the automation name. You can add input variables for the automation name and url so that you do not have to hardcode them into your script. Set the input variables when you configure the automation, and reference the input variables inside the script.
Feb 28, 2023 10:15 AM
Thanks! That will be cleaner than having them in the script. Should definitely include the url to make it easier to get back to the automation.