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 Apps / Passing parameter that...
Power Apps
Answered

Passing parameter that can be Null to Flow

(1) ShareShare
ReportReport
Posted on by 62

Hello.

 

I have build a Power Automate flow that takes inputs from PowerApps. It has a few mandatory parameters and an optional String parameter ("varPergunta6").

 

shot2.pngshot1.png

 

The thing is, in the way my app currently works, the value sent in "varPergunta6" may sometimes be Null, because it stems from a non-mandatory question in a formulary. I thought making the field optional would allow that, but apparently not, because I'm getting the following error:

 

1659450811545.jpg

 

This is the code I'm using to call the Flow:

 

submitRespostaTreinamentoV2.Run(
 tempCodResposta,
 tempCodVisitaOS,
 tempPergunta1,
 tempPergunta2,
 tempPergunta3,
 tempPergunta4,
 tempPergunta5,
 {text_4: tempPergunta6}
);

 

Sending an empty String "" instead of the Null value would not help me because the empty String will be represented differently in the database. And also because that would not be possible to do in other cases where the parameter is an Integer instead of a String

 

Is there any workaround for this?

 

Thanks in advance.

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,678 Moderator on at

    Hello, @linx9 , You can use an expression like the one below in your Insert Row action for this Field:

    if(
    empty(varPergunta6),
    null,
    varPergunta6
    )

     

     

    Regards,

    Ahmed

    If my reply helped you, please give a 👍. And if it has solved your issue, please consider a 👍 & Accepting it as the Solution to help other members of the community find it more.

    My Blog: www.powerplatformplace.com

  • linx9 Profile Picture
    62 on at

    Hi @AhmedSalih 

     

    Thanks for the input. That unfortunately does not solve the problem.

     

    The error I get when calling the Flow in PowerApps is happening before the Flow even gets executed, so the problem is not coming from things inside the Actions. The error comes from something in the interface between PowerApps and Power Automate that does not allow me to even send a Null parameter to the Flow.

     

    The actions inside the flow are working just fine because I tested them manually before trying to call the Flow from PowerApps

     

    Best regards

  • v-peijunz-msft Profile Picture
    Microsoft Employee on at

    Hi @linx9,

     

    Maybe you could try to pass the blank string from Power Apps to flow instead of sending a null parameter.

    Based on your description, I have made a simple test for your reference.

    1. I use a SharePoint list called Ignoreblank as my data source. The Initiative has no value in the first record.

    vpeijunzmsft_0-1659594293611.png

    2. In Power Apps, insert a button and write the formula in its OnSelect property as follows:

    FlowInApp.Run(If(IsBlank(First(DataSource).ColumnName),"",First(DataSource).ColumnName), First(DataSource).ColumnName))

    vpeijunzmsft_1-1659594293617.png

    3. In Power Automate: If there is a blank in field, then use the null value.

    if(equals(length(triggerBody()['text']), 0), null, triggerBody()['text'])

    Here is my flow:

    vpeijunzmsft_2-1659594293620.png

     

    Best regards,

    Sylvia

  • Verified answer
    linx9 Profile Picture
    62 on at

    Hi @v-peijunz-msft 

     

    Thanks for the input. Unfortunately using an empty String is not a good solution for me because that won't work for Integer and Boolean parameters.

     

    However, I have a found a working solution in the meanwhile. I will post it here in case anyone end up facing the same problem in the future.

     

    I created an "Optional" parameter of the type String in the inputs from PowerApps. This argument will contain all the optional parameters I would like to use in a JSON format.

    shot1.png

     

    This parameter is then parsed by a "Parse JSON" action:

    shot2.png

     

    The results from the Parse JSON can then be passed to SQL by using the coalesce function, which prevents the "Insert row" block from throwing errors when the Optional argument is null: coalesce(body('Parse_JSON')?['Pergunta3'])

    shot3.png

     

    I am using the following code when calling the flow from PowerApps:

    ForAll(ModificacoesRespostasAcompanhamento,
     updateRespostaAcompanhamentoV4.Run(
     tempCodResposta,
     tempCodVisitaOS,
     tempPergunta1,
     tempPergunta2,
     JSON({
     Pergunta3: tempPergunta3,
     Pergunta4: tempPergunta4,
     Pergunta5: tempPergunta5,
     Pergunta6: tempPergunta6,
     Pergunta7: tempPergunta7,
     Pergunta8: tempPergunta8
     })
     )
    );

     

    Best regards

  • WO-23071515-0 Profile Picture
    on at
    Thank you, this is brilliant and you're a life saver

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard