You are currently viewing Power Pipelines and Enhanced ALM Part 4 – Solution Approvals

Power Pipelines and Enhanced ALM Part 4 – Solution Approvals

Approvers

With the core of the app created we now need to define how approvals will be done. To do this we will create a new table called Power Platform Project Approvers. Use the following Diagram to construct the table

--- title: Approvers ERD --- erDiagram Approvers}| -- || Entra :contains Entra{ int EntraID PK } Approvers { string ApproverName PK choice Role coice RoleContext lookup MicrosoftEntraID-POC FK }
  1. Create the table with its Primary Column as Approver Name set the Required to Optional
  2. Add a new choice column called Role, with a local choices
  3. Add another choice column called Role Context with a global choice called Context
  4. Add one more lookup column to the Entra ID table called POC
  5. Update the Main form as follows
  6. Update the main view as follows
  7. In the MDA add a new area called backend and add the table
  8. To set the Approvers Name, we could use a Power Automate flow, JavaScript, or a Plugin. For this scenario I am going to use the Dataverse Accelerator App (yes I know it is preview, but its great).
    Set('Approver Name',ThisRecord.POC.'Display Name')
  9. The Approvers Name will now be properly set upon creation

Approval Setup

  1. Create two lookup columns in the Power Platform Projects table, each pointing to the Approvals Table. Call the first one Team Lead Approval and the second one Branch Chief Approval.
  2. Add the lookups to the main form in a new hidden tab call Approvals (we will do more with it later)

Project Approval Workflow

The last step will be to send an approval to the Team lead to start gathering basic requirements so estimation can occur.

đź’ˇ The estimation feature will be added at a later time

  1. Create a Power Automate flow called “1.1 - When a new Project is Requested (Power Platform Management)”, with a Dataverse trigger of “When a row is added, modified or deleted”.
  2. Add a Parse JSON Action that will read the output of the trigger
  3. Add an Array Variable called varUserArray
  4. Add a String Variable called varEmails
  5. Create a Scope Control called Get User
  6. Add a Dataverse List Rows action that filters off for the role Team Lead (435700000)
  7. Within an Apply to Each appended to the varUsersArray the POC information
  8. Parse the JSON of the varUserArray to make it dynamically accesible
  9. Within another Apply to Each lookup the Users info and append to the string variable varEmails the users Email
  10. Add another Scope Control called Approval
  11. Add a Scope Control inside and add three actions,
    1. Dataverse Get Row by ID for the Users table that uses the Created By as the ID
    2. Dataverse Get Row by ID for the Persons (Contacts) table that uses the Project Customer as the ID
    3. O365 Get user profile that uses the Project Lead value as the UPN
  12. Create an Approval action as follows
  13. Add two Dataverse Update a row actions
    1. Table-Power Platform Projects, ID Projects ID, Team Lead Approval will be the approval just created
    2. Table-Approvals, ID Approval created above, Name will be the title of the Approval (this is to make it “simple” to view)
  14. Add a Wait for Approval Action using the ID of the approval from above
  15. Add a Condition based on the outcome of the approval
  16. If Approved we will need to add a row to the solutions table in the Development Environment. Because this needs to run from the Production Environment and this needs to leave my tenant I will add an Environment variable called Dataverse Development Environment

    đź’ˇ Before Publishing this we will be removing the current value. If this is not done, then we will have to manually fix it in Test and Production

  17. Next we will add an Environment variable called Publisher ID for the solution publisher (this is done to ensure we have the publisher we want)
  18. Then we will add a Environment Variable called Dataverse Development Environment ID
  19. The last Environment Variable will be for the Power apps URL. Depending on the cloud you are in this may differ, so it helps to have a variable set it for us
  20. Add a Scope Control that will help us clean the project Name String before being added. This is being done because the name must not contain any special characters or spaces.
  21. Add a Compose called bad Characters
    ["-","~","#","%","&","*",":","<",">","?","/","","{","|","}"]
  22. Add a Select and add the following Expressions
    range(0, length(triggerOutputs()?['body/andy_projectname']))
    if
    (contains(outputs('Compose_-_Bad_Characters'), substring(triggerOutputs()?['body/andy_projectname'], item(), 1)),
     '',
     substring(triggerOutputs()?['body/andy_projectname'], item(), 1)
    )
  23. Add a Compose Action that joins the string back together.
    join(body('Select_-_Remove_Unwanted'), '')
  24. Finally add a compose action that will remove any spaces from the string
    replace(outputs('Compose_-_Clean_Project_Name_Join'),' ','')
  25. Add a Scope Control that called Scope - Create Solution in Dev
  26. Add a Dataverse Add a new row to selected environment Action
    1. The Environment will be the Environment variable “Dataverse Development Environment” set earlier
    2. The Table name will be Solutions
    3. The Name will be the output of “Compose - Clean Project Name Remove Spaces”
    4. The Publisher will be the Environment variable “Publisher ID”. Make sure to type the publisher as shown below.
  27. One more Dataverse Update row will be added. This will update the table with the Name of the Solution.

    đź’ˇ We are using the name vs a GUID because when it comes time to verify the solution in our pipeline all we have access to is the name

  28. The last action in this path will be to send an email if it has been approved.
  29. Add a Send an Email Action
    1. To will be to the Primary Email of the submitted
    2. The Subject will contain the Project Name
    3. The Body of the Email will have a note and a link to the solution. The Link will be constructed as follows
      1. Power apps URL environments/Dataverse Development Environment ID/solutions/Solution identifier
    4. CC will be the approvers
  30. If denied, we will send an email. Note, the link to the app is currently not loaded in, we will get that added when we push the solution to production.

Push to Test

  1. For each Environment Variable, remove the default value, then push the solution to test
  2. Update each variable to the appropriate value via the pipelines menu
  3. With the solution in Test create a request and verify that the solution is created in the Development Environment.

If you have any issues or questions feel free to send a message. If you simply want to download this solution you can find it all stored on my GitHub

Leave a Reply