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 / calling Powerautomate ...
Power Apps
Answered

calling Powerautomate from Formulas

(0) ShareShare
ReportReport
Posted on by 98
Hi,
I have a powerapps with UDF that calls a powerautomate flow. 
 
This works fine in Preview mode, but the published version does not trigger the flow at all.
 
Am I missing something?
 
Thanks,
Bart
Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    Can you show the function you are using? Did you wrap the call in braces {}?

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • xecho Profile Picture
    98 on at
    This is the UDF, but I want to emphasize that in Preview it works but not in Published mode:
     
    ReadRACUsers(): Void = {
        Notify("Reading RAC customers...", NotificationType.Information, 1000);
     
        Set(showRACUsersSpinner, true);    
        Clear(collRACUsers);
        ClearCollect(
            collRACUsers,
            ForAll(
                Table(ParseJSON(GetSPItemsv2.Run("RAC Users").result)),
                {
                    ID:                             Value(Value.ID),
                    ContactID:                      Value(Value.Title),
                    'Customer ID':                  Text(Value.CustomerID),
                    ContractID:                     Value(Value.ContractID),
                    'Site Number':                  Text(Value.Site_x0020_Number),
                    'Customer Name':                Text(Value.Name1),
                    Email:                          Text(Value.Email),
                    'Phone number':                 Text(Value.Phone_x0020_number)
                }
            )
        );
        Set(showRACUsersSpinner, false);    
    };
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    I thought maybe it would be your Void return data type and that you might need to define a custom data type to return the table.  But after testing some other examples this does appear to be one of the current limitations on User Defined Types.  You can't invoke a Power Automate flow, even a simple one.  I suspect its because you are invoking code that is external to the Power App of the User Defined function.  But it does seem to be a current limitation.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Verified answer
    MarkRahn Profile Picture
    1,229 Super User 2025 Season 2 on at
    Hi @xecho and @Pstork1
     
    Since the UDF does not appear to be able to currently call a Power Automate flow within the code, do you think it would be possible to rework things like this:
     
    Calling the UDF:
    ReadRACUsers(GetSPItemsv2.Run("RAC Users").result);
     
    The UDF code would then be:
     
    ReadRACUsers(dataResult: String): Void = {
        Notify("Reading RAC customers...", NotificationType.Information, 1000);
     
        Set(showRACUsersSpinner, true);    
        Clear(collRACUsers);
        ClearCollect(
            collRACUsers,
            ForAll(
                Table(ParseJSON(dataResult)),
                {
                    ID:                             Value(Value.ID),
                    ContactID:                      Value(Value.Title),
                    'Customer ID':                  Text(Value.CustomerID),
                    ContractID:                     Value(Value.ContractID),
                    'Site Number':                  Text(Value.Site_x0020_Number),
                    'Customer Name':                Text(Value.Name1),
                    Email:                          Text(Value.Email),
                    'Phone number':                 Text(Value.Phone_x0020_number)
                }
            )
        );
        Set(showRACUsersSpinner, false);    
    };

     
    I going to suggest using With() in the UDF but since Pstork1 indicated that the UDF was unable to call any Power Automate flow then I would go with a different suggestion.
     
    This community is supported by individuals freely devoting their time to answer questions and provide support. They do it to let you know you are not alone. This is a community.

    If someone has been able to answer your questions or solve your problem, please click Does this answer your question. This will help others who have the same question find a solution quickly via the forum search.

    If someone was able to provide you with more information that moved you closer to a solution, throw them a Like. It might make their day. 😊

    Thanks
    -Mark
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    Just tested @MarkRahn's workaround and it seems to handle the problem.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • xecho Profile Picture
    98 on at
    Thanks to everyone for the quick response and help.
     
    It seems to have been a glitch in Powerapps, it suddenly started to work.
     
    @MarkRahn: The rewrite of the function was something I was thinking about and it did work. For now I left it as originally created since it seems to work (again).
     
    Thanks!
  • xecho Profile Picture
    98 on at
    Thanks to everyone for the quick response and help.
     
    It seems to have been a glitch in Powerapps, it suddenly started to work.
     
    @MarkRahn: The rewrite of the function was something I was thinking about and it did work. For now I left it as originally created since it seems to work (again).
     
    Thanks!
  • MarkRahn Profile Picture
    1,229 Super User 2025 Season 2 on at
    Hi Bart,
     
    I'm glad it started working for you!
     
    Could you throw Paul and/or I a Like or mark one of the Replies as an Answer? It helps other users who may be having a similar problem find an answer.
     
    This community is supported by individuals freely devoting their time to answer questions and provide support. They do it to let you know you are not alone. This is a community.

    If someone has been able to answer your questions or solve your problem, please click Does this answer your question. This will help others who have the same question find a solution quickly via the forum search.

    If someone was able to provide you with more information that moved you closer to a solution, throw them a Like. It might make their day. 😊

    Thanks
    -Mark
  • Verified answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    I've tested my original code and Its also started working.  Must have been some kind of temporary outage.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • xecho Profile Picture
    98 on at
    I liked the posts of both of you ;-).
     
    The mark as answer doesn’t seem to work, it gets stuck on the spinning circle, must be another glitch ;-).
     
    thanks!

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard