cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mmattar
Level 8

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
Dual Super User
Dual Super User

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
Dual Super User
Dual Super User

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.
mmattar
Level 8

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

 

Dual Super User
Dual Super User

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.
mmattar
Level 8

Re: Azure Functions

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

Dual Super User
Dual Super User

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

mogulman
Level 8

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++;
                    }
mmattar
Level 8

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 ? 

Dual Super User
Dual Super User

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.
mogulman
Level 8

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
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,336)