I have a pipeline where the following activities takes place Lookup-> Lookup ->ForEach->(Stored Procedure)-> Send Success Email/ Send Failure Email
Once the pipeline successfully completed its execution, I see a successful email in my inbox, however for any reason the foreach activity fails I don't see a Failure Email. Inside Foreach Stored procedure might get executed dynamically sometimes based on N number of times.
Inside foreach I have only one activity (Stored Procedure execution).
This is the configuration for Email Failure message, I do try to pull the dynamic error message, so I have added a code as "ErrorMessage":"@{activity('Lookup').output.message}", It shows me Error.Message is not a property, Moreover I wanted to get a Failure email Configuration for Success Email, works perfectly fine
I have achieved the above task by modifying my pipeline with Lookup->Lookup->ForEach(Stored Procedure -> If Condition-> WaitTrue/WaitFalse -> WebJob to send email which I have added to a separate pipeline)
Under if condition activity checking for Error status from previous activity
@contains(activity('Load Tables').Status,'Succeeded')
In case of Failure, the status would be Error and catching the message as
"errorMessage":"@{activity('Load Tables').Error.message}"