cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Responsive Resident
Responsive Resident

Azure Functions

Hello,

 

I have an app that has a good amount of business logic and its becoming very messy to open up blank screens to create controls to be looked at that other screens will look at for rules. Is thier a way i can write my code in one defined place, i seen the use of Azure functions can someone explain that and will it help ? thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Azure Functions

No, not directly.  You can pass content to the function and receive results back that can then be displayed in the forms.  But the function itself runs external to PowerApps, so think of it like a black box.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

13 REPLIES 13
Highlighted
Dual Super User III
Dual Super User III

Re: Azure Functions

Think of Azure Functions like webservices that you can call to calculate some data.  They are a definate option for offloading business logic.  The one downside to be aware of is that calling them requires the use of Send an HTTPS request which is a premium feature so it may require additional licensing if your license is just the one that comes with Office 365.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Responsive Resident
Responsive Resident

Re: Azure Functions

ok, so for example. I have a record in a SQL Table that contains a couple columns as date/time types. Would i be able to use Azure functions to create some business logic that says "hey this time cannot overlap that, and or if this time is the same as that add 15 seconds", just a high level overview of what id like to accomplish

 

Highlighted
Dual Super User III
Dual Super User III

Re: Azure Functions

Yes, you could do that.  Here's a Blog post on how to use Azure functions in PowerApps.

https://powerapps.microsoft.com/en-us/blog/using-azure-functions-in-powerapps/



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Responsive Resident
Responsive Resident

Re: Azure Functions

with azure functions i will be able to interact with forms and controls within the canvas app ?

Highlighted
Dual Super User III
Dual Super User III

Re: Azure Functions

No, not directly.  You can pass content to the function and receive results back that can then be displayed in the forms.  But the function itself runs external to PowerApps, so think of it like a black box.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Skilled Sharer
Skilled Sharer

Re: Azure Functions

I use Azure Functions (AF) to process a complicated business process.  It involves tracking of numerous documents and approvals/execution.   Overall there are 120+ possible steps.  I have one main table in Azure SQL DB that tracks progress in the flow.  When one step completes the AF sends out an email for the next step.  When a user completes a task they reply "Done" in the email.  The AF reads the email every 5 minutes looking for "Done" emails and if it finds one marks step complete, runs process again looking for next step.  I don't use HTTP so no special licensing.  This allows me keep PowerApp as simple as possible.  All complicated steps are in AF.  For example calculating Business Days is very complicated since I have to account for bank holidays.  Doing this in C# is easy.  This is an example of a step in AF:

 

                    if (!(bool)r["MLFpSent"] && !td.ContainsKey("MLFpSent") &&
                       (((int)r["DBLSource"] != ld["DBLSource,Not Applicable"] && (bool)r["DBLBuyerExecuted"] &&
                       (bool)r["DBLSellerExecuted"]) || 
                       ((int)r["DBLSource"] == ld["DBLSource,Not Applicable"] && dd["MLFDeadline"] >= CalcDate(today, "BD|-1", hd))))
                    {
                        CreateTask("MLFpSent", id, r, out taskId, ld, emd, dd, hd, TESTFLOW, runCnt, loopCnt, ref eMsg);
                        SendEmail(taskId, id, ss1, TESTFLOW, ref eMsg);
                        cnt++;
                    }
Highlighted
Responsive Resident
Responsive Resident

Re: Azure Functions

Would you mind showing me how i can utilize AF with no HTTP requests due to licensing. I want to be able to code my business logic out of the PowerApp, how may i go about setting this up ? 

Highlighted
Dual Super User III
Dual Super User III

Re: Azure Functions

What he is describing is an Azure Function that just runs in the background processing the data that the PowerApp uses.  There is no way to invoke an Azure Function from a Powerapp other than using HTTPs.  I don't think his scenario matches what you are trying to do.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Skilled Sharer
Skilled Sharer

Re: Azure Functions

@Pstork1You are correct process runs async to PowerApps.  Originally I used HTTP to trigger flow from PA but when you made licensing change I modified business process so it wasn't required.  I still use HTTP from Visual Studio to test AZ. 

 

        [FunctionName("TradeFA")]
        public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, ILogger log)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,179)