Hello, Today in this blog we are going to see how to integrate with microsoft power automate for teams approval Part -1.
Sample Business Use Case:
Let's consider a scenario Customer onboarding process [COP], Where the sales representative has to create the customer onboarding process case on behalf of customer and once details [Basic information] are captured then case should be routed to the Admin approval. Now we have a requirement like every time the admin cannot login to the aplication and give approval.
So we need teams approval, when ever a new COP case is created and routed to admin the new approval request should be created along with case details and send it admin via teams then admin should have an option to give comments, approve or reject the case.
I have divided the blog into 2 parts.
Part-1: Integrating pega with power automate for teams approval.
Part-2: we will have the case processing based on teams outcome based approval / rejection and save the customer record to into customer table.
Part -1:
Step-1: Click on the link https://make.powerautomate.com/ and login to power automate using microsoft account credintials
Step-2: After logging home screen will appeared.
Step-3: Now from left navigation click on the + Create option.
Step-4: After clicking that create option a new landing page will appeared from there we have to create "Automated cloud flow".
Step-5: From the above image click on the "Automated cloud flow" and a pop up will appeared and press skip button.
Step-6: Refer below image, Now we have to give some name to the flow i have given it as "CUSTOMER ONBOARDING FLOW", and later we have start our flow by adding connectors and triggers.
Step-7: Search for "When a HTTP request is received" in the search bar and add the trigger by selecting it.This HTTP Request POST Method trigger is used to invoke the flow in microsoft power automate.
Step-8: After selecting trigger we have provide the "Request Body JSON Schema" so when ever any one using this HTTP POST URL they have to send JSON data so we can use that data in our power automate flow for data processing..
Now click on the below "Use sample payload to generate schema".
Step-9: After clicking that we will see pop-up to provide the sample JSON Payload, this JSON Payload is used to generate the JSON Schema.
Provide the below Sample JSON payload and click on Done.
{"Case-ID":"","Approver-Name":"","Customer-Details":""}
Step-10: After clicking on done we can see from below image that "Request Body JSON Schema" has been generated automatically based on sample JSON Payload.
Lets add + new step for sending response back once request receives now click on new step.
Step-11: After that search for "Reponse" in search bar and select "Response" Action like below image.
Step-12: And now give the body in Response Action, and save the flow. Afte that click + new step for triggering the creation of approval request in teams.
{"Status-Message": "Request Received"}
Step-13: Like earlier this time search for "Start and wait for an approval" and select Start and wait for an approval action like below.
Step-14: Select the approval type - "Approve/Reject - First to respond" from dropdown.
Step-15: Now we have to give Title, Assigned to, Details.
- First in Title hardcoded CUSTOMER ONBOARDING but selected case id from dynamic content, as this data was coming from JSON Request received.
- For Assigned to, Details also selected from Dynamic content see below image so that the data which which came through JSON will placed here.
Now save the CUSTOMER ONBOARDING FLOW.
Step-16: Now let's copy the Request POST URL in the first step of the flow so that we will use it in pega while creating Connect REST rule from Wizard.Configuration for Triggering approval request in teams is done in Power automate flow now let's go to pega application for integrating with it.
Pega Integration:
Step-1: From Configure > Integration > Connector > Create REST Integration. Using Wizard weare creating connector rule.
Step-2: Give Name : COP Power Automate and paste the endpoint URL that you copied from power automate.
After pasting the endpoint URL the resource path parameters , query string parameters will be added by system from the URL. Then click on next.
Step-3: Give the resource name as COP TEAMS Approval and select the method POST and click on next.
Step-4: Now we have to add a REST response so that pega can create data model it self based on request sent & response received.Click on add REST response.
Step-5: Now provide that sample JSON Payload like below image. for approver name it was the microsoft account email id so i have masked it.
Step-6: After providing the JSON Data click on run button then response will received like the below image.Actually the CUSTOMER ONBOARDING FLOW got triggered and sent the response back.
Step-7: If you see in teams below image an approval request was sent to user based on Approver name from JSON data.
Step-8: If you click on that approval request you can see the data case id, customer details was sent from pega to teams approval request.
Step-9: If you scroll down you can see who requested the approval, and who's reponse is required for this approval request can be seen.
Step-10: For now i am clicking on approve button, then the status of this request will changed from Requested --> Approved.
Step-11: So this how an approval request will sent to person based on approver name we give.
Step-12: Now come back to pega to complete the integration configuration, click on submit button after getting the response in Respose tab.
Step-13: Click on next button.
Step-14: Give the Int ruleset for integration layer, and normal ruleset for data layer rules, And check the classes where those are getting created,
Step-15: After that click on create button so the rules will be created by system based on request & reponse.
Step-16: We have created connector rule using the Wizard but we can create manually also, but in this blog i have created using wizard.
////***************////
Finally, in this Part-1:
We have created power automate flow to trigger approval request in teams and integrated with pega too.
And in next Part-2 we will see continution based on approval & rejection from teams the case in pega application should get's processed..
0 Comments