DEV Community

Muhammad
Muhammad

Posted on

How to make re-usable and Generic Power Platform Application

I often receive app development tasks which are quite similar in nature, like create Leave approval form, or create a Capex approval form, or create an Employee onboarding form etc.

They are similar because they follow similar workflows like a user will fill out the form and then the form will go for approval from Manager, and then it sends alert to Finance/helpdesk/HR etc.

And the development starts with similar steps as well like, first we need to create a data source like Sharepoint List or SQL Table, and then create a powerapp application, then connect the data source to powerapps, and then create a form in the powerapps and so on and so forth.

Even though Microsoft is working quickly towards modularization of apps like they introduced powerapps components some time ago, but still lots of manual work is involved.

I have done a workaround some time ago to deal with the similar tasks. I call it workaround as some of the steps are not optimum, and there are some side effects as well, but still, in my opinion, they are better than nothing.

In this article I will not discuss the basic steps of creating the sharepoint list, powerapps and flows, there are lots of tutorials already available on internet for that, and you can google them😊.

Summary of Steps:

  1. Create a data source ( Sharepoint List exactly) with generic fields.
  2. Create another Sharepoint List having steps of Workflow, we are calling it "Steps Sequence".
  3. Create powerapp and convert/concatenate all the data in string format, and populate the generic fields we have created in step 1 with this data.
  4. Create a Power Automate flow which gets Workflow Steps from list "Step Sequence" and parses the generic data.

Step 1: Create a data source with Generic fields.

First I have created a generic data source (Sharepoint List in my case). You can see in the image below, "Text" is the generic fields. Some common fields are there like Business Unit, Application, Manager, Status and Department, all of the applications created using this approach will have these fields. I can say that "Application" field is must for this approach. Using this field we will filter the data based on different applications.

Alt Text

Step 2: Create Sharepoint List having list of steps of Workflow

So here we have created Sharepoint list "Steps Sequence", detail of some important columns are,

Application: Name of application
Step: Sequence number of step
Action: what is expected at this step
Users: User responsible for this action

Alt Text

So for example we want to create an "Onboarding" application which, after submission of request, first goes for "Approval from HelpDesk", and after Helpdesk Approval notifies the Finance department, and then Notifies the Manager of User, the entries in "Steps Sequence" list will be something like.

Alt Text

Step 3: Create powerapp Application
To demonstrate this, I am creating an offboarding form in this step,

Alt Text

I have connected this powerapp form to the sharepoint list of Step 1.

Common fields like Business Unit, Employee Name, Department and attachments have their default DataCards in the form, I have made the "Application" field invisible and set it's default to application name "offboarding". I have also made "Text" field as invisible, and made its default value to a context variable "TextString".

Alt Text

For the rest of the fields like Last Working Day, Backup Required, Personal email address, I have created a concatenated string "TextString". And then submit the Form.

As "Textstring" variable have concatenated string, so its value will be saved in the Sharepoint List in the "Text" field when we submits the form.

Step 4: Create a Power Automate flow
In Power Automate we have two fun parts,

First we need to process the concatenated string in the "Text" field.

Secondly we need to act on workflow actions based on "Steps Sequence" list we have created in Step 2.

Process the concatenated string in the "Text" field

In this step, first I am creating html of the "Text" field, and also generating plain text separated by colon.

Alt Text

Workflow action based on "Step Sequence" list.

In this step, first I am getting all entries of offboarding application from "Step Sequence" list, and I have created parallel conditional branches to deal with different actions.

Alt Text

For example: implementation of Alert Condition branch will be something like that,

Alt Text

You can create different branches to deal with different requirements, for example, I once created a branch having third party connectors to transfer data to another database .

And Some Drawbacks,

I don't use this approach, if user wants searching in lots of the fields, or user wants complex applications with lots of calculations on the field.

For complex applications, I prefer to keep things separate in a different Sharepoint list and Power Automate Flow.

It is difficult to debug if something goes wrong, So logging in the flow should be good, I always create a StatusTrail field, and I log every major action of my workflow.

Creating another application after setting up the first one:
So we have setup our first application, and now we want to develop our second application, say "Employee Information Update":

So first we need to go to "Steps Sequence" list, and add the steps of worklfow defined in Step 2.

Second, we need to create powerapp form having Custom DataCards for new fields and Concatenated Strings as we have done in Step 3 .

And if there are no new actions than its all done.

Top comments (0)