web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Error calling SQL Stor...
Power Automate
Unanswered

Error calling SQL Stored Procedure from Condition

(0) ShareShare
ReportReport
Posted on by 73

Here is the error:

<quote>Flow save failed with code 'InvalidVariableOperation' and message 'The inputs of workflow run action 'Condition' of type 'If' are not valid. The variable 'SP_PAB_Contacts' must be initialized before it can be used inside action 'Condition'.'.</quote>

I'm calling a SQL Stored Procedure (SP1) and parsing its results set in order to populate CDS Account records. I have a condition (Condition 4) that evaluates if the CDS Account exists or not. In this case, when it does not, I want to create it. After the CDS Account is created I need to call another SQL Stored Procedure (SP2) to get other information to populate CDS Contacts. 

The result is the error above and I've been unsuccessful in finding any meaning to the error or guidance for a potential fix. I'm stuck and cannot Save my work in this state. I'm also prevented from moving objects around in order to save my work due to dependencies. 

FLOW_ConditionError.png
Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,383 Most Valuable Professional on at

    I think your problem is in condition 4.  I assume you are getting the length of the results returned from your check for accounts.  But if it doesn't find any then the result is null.  You can't get the length of a null result.  So the condition is failing.  In Condition 4 add a first check to see if the variable you are taking the length of is null (use the expression tab to input the null value).  The condition will evaluate that clause first and fail if the value is null.   Also switch the length check to Greater than 0 and swap the Yes and no sides of the condition.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 641

#2
Vish WR Profile Picture

Vish WR 640

#3
Haque Profile Picture

Haque 495

Last 30 days Overall leaderboard