Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
prajwal_mahale
New Member

Expression to check if predecessor activity was executed

I have developed a pipeline that incorporates a conditional flow. Based on whether a specific condition is true or false, a corresponding set of activities is executed.
True Condition: Executes Set A of activities.
False Condition: Executes Set B of activities.
I have a successor Outlook activity linked to the "If" activity, which is used to send a notification in case of execution failure. However, since some activities are not executed based on the condition, the expression in the Outlook activity to check the "If" activity's output for errors throws the following error:"Property cannot be evaluated because property 'Error' cannot be selected."

My understanding is that we can only refer to activity outputs for those activities that have been executed in expressions.

Question:
Is it possible to check if the predecessor activity was triggered using expressions, so I can determine if the activity has an output?

1 ACCEPTED SOLUTION
v-kongfanf-msft
Community Support
Community Support

Hi @prajwal_mahale ,

 

You can use the @activity function in an expression to check if the preceding activity is executed. Below is an example:

@if(equals(activity('YourActivityName').status, 'Succeeded'), 'Activity was executed', 'Activity was not executed')

In this expression, replace YourActivityName with the name of your front activity. This will check the status of the activity and return a message indicating whether or not it was executed.

 

If you need to check for errors specifically, you can modify the expression to check for the presence of the error attribute:

@if(equals(activity('YourActivityName').status, 'Failed'), 'Activity failed', 'Activity succeeded or was not executed')

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
v-kongfanf-msft
Community Support
Community Support

Hi @prajwal_mahale ,

 

You can use the @activity function in an expression to check if the preceding activity is executed. Below is an example:

@if(equals(activity('YourActivityName').status, 'Succeeded'), 'Activity was executed', 'Activity was not executed')

In this expression, replace YourActivityName with the name of your front activity. This will check the status of the activity and return a message indicating whether or not it was executed.

 

If you need to check for errors specifically, you can modify the expression to check for the presence of the error attribute:

@if(equals(activity('YourActivityName').status, 'Failed'), 'Activity failed', 'Activity succeeded or was not executed')

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

November Update

Fabric Monthly Update - November 2024

Check out the November 2024 Fabric update to learn about new features.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.