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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Set Variable empty value
Power Automate
Unanswered

Set Variable empty value

(0) ShareShare
ReportReport
Posted on by 158

I am trying to build a multiple approval workflow the will return the approval comments in the email I tried setting it up multiple times. 

Test 1

  • If approved, update SharePoint
  • send 2nd approval to manager with associate approval comments in email from update SharePoint
    • creates an apply to each for every approval comment (Form is built to have up to 3 associate approval comments)

Test 2

  • Create an initialize variable for each approval comment so apply to each does not happen on manager approval flow
    • error message when Associate 3 comment section blank
      • How do I set my variable to return NA if null?

KhrystinaM_0-1695146238098.png

 

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at

    Hey @KhrystinaM 

     

    You can write a similar expression as below:

     

    1)

    If(equals(variables('VariableName'),''),'NA',variables('VariableName'))

     

    2)

    If(equals(variables('VariableName'),null),'NA',variables('VariableName'))

     

    I hope this helps 🙂

  • KhrystinaM Profile Picture
    158 on at

    @Sundeep_Malik Do I apply option 2 to the set variable? I tried that and I'm getting an error. 

    KhrystinaM_0-1695147564290.png

    KhrystinaM_1-1695147573782.png

     

  • Sundeep_Malik Profile Picture
    6,484 on at

    Oh my bad.

     

    Actually replace variables('VariableName') 

    part with the comment expression. 

     

     

  • KhrystinaM Profile Picture
    158 on at

    @Sundeep_Malik I input the following. 

     

    if(equals(variables('Associate_3_Approval')?['body/outcome']),null),'NA',variables('Associate_3_Approval')?['body/responseSummary']))
     
    I'm getting this error
    Flow save failed with code 'WorkflowRunActionInputsInvalidProperty' and message 'The inputs of workflow run action 'Set_variable_4' of type 'SetVariable' are not valid. Self reference is not supported when updating the value of variable 'varAssociate3'.'.
     
    Should my initialize variable have a value? I tried adding a value and removing the set variable, but I got an error for that as well. 
    KhrystinaM_0-1695150180922.png

     

  • Sundeep_Malik Profile Picture
    6,484 on at

    @KhrystinaM 

     

    You can directly write the following expression:

     

    if(equals(items('Apply_to_each_-_Associate_3')?['comments'],''),null,items('Apply_to_each_-_Associate_3')?['comments'])
     
     
    If the above does not work, replace '' with null
     
    I hope this helps 🙂
  • KhrystinaM Profile Picture
    158 on at

    @Sundeep_Malik Hello, I tried both options on the set variable field and got this error. 

     
    ExpressionEvaluationFailed. The execution of template action 'Apply_to_each_-_Associate_3' failed: the result of the evaluation of 'foreach' expression '@outputs('Associate_3_Approval')?['body/responses']' is of type 'Null'. The result must be a valid array.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard