Home > Blockchain >  Send email notification failure Azure Pipeline not working (Web Job)
Send email notification failure Azure Pipeline not working (Web Job)

Time:10-26

I have a pipeline where the following activities takes place Lookup-> Lookup ->ForEach->(Stored Procedure)-> Send Success Email/ Send Failure Email enter image description here

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 enter image description here Configuration for Success Email, works perfectly fine enter image description here

CodePudding user response:

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) enter image description here enter image description here

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}"
  • Related