Skip to main content

3. Use Custom Connector

LAB SCENARIO

Working as part of the PrioritZ fusion team you will be configuring a custom connector for an existing API. The team would like to add badging to the PrioritZ application to give credit to users when they have completed ranking an item. The team identified an existing API, but it doesn't have a Power Platform connector.

When you review the API, you see that it has four operations and uses API key authentication.

In Exercise 3 you will test the custom connector you created using a flow and a canvas application.

3.1 Test connector from canvas app​

Note

In this task, you will use the custom connector you created to show the user’s current badge on the PrioritZ Ask canvas application.

  1. Navigate to Power Apps maker portal and make sure you are in your dev environment.
  2. Expand Solutions and open the PrioritZ solution.
  3. Select Apps, select the PrioritZ Ask application, and click Edit.

Lab-03 Image

  1. Select Data from the left and click + Add data.

Lab-03 Image

  1. Expand Connectors and select the Badges connector you created.

Lab-03 Image

  1. Click + Add a connection.

  2. Open a new browser tab or window and navigate to Contoso Coffee Badges

  3. Click on open the API Key link

Lab-03 Image

  1. Copy the API Key. Keep this API Key in a notepad, you will need it again.
  2. Go back to the app designer, paste the API Key you copied, and click Connect.

Lab-03 Image

  1. Select the Tree view.

  2. Select the Components tab, click + Insert tab, search for image and select Image.

Lab-03 Image

  1. Change the Image name to User badge.

Lab-03 Image

  1. Set the User badge Image value to the formula below.
ContosoBadges.getcurrentbadge({id:User().Email}).image

Lab-03 Image

  1. Set the Tooltip value of the User badge to the formula below.
ContosoBadges.getcurrentbadge({id:User().Email}).name
  1. Make the image smaller and move it to top right corner of the screen.
  2. The User badge should now look like the image below.

Lab-03 Image

  1. Select Screens tab in the Tree view. Click Play button.
  2. Hover over the badge to see the badge name.

Lab-03 Image

  1. Close the preview.

3.2 Publish the connector​

  1. Click Publish.
  2. Select Publish this version.
  3. Go back to the solution by clicking on the Back button.

Lab-03 Image

Note

Do not navigate away from this page.

3.3 Test connector from flow (optional)​

  1. Make sure you are still in the PrioritZ solution.
  2. Click + New and select Automation | Cloud flow | Instant.

Lab-03 Image

  1. Enter Test add credit for flow name, select Manually trigger a flow, and click Create.

Lab-03 Image

  1. Click + New step.

  2. Select the Custom tab and then select the Add credit action.

Lab-03 Image

  1. Enter Test connection, paste the API Key you copied earlier, and click Create.

Lab-03 Image

  1. Click on the recipientId field, go to the Dynamic content pane, and select User email.

Lab-03 Image

  1. Click on the name field, go to the Dynamic content pane, and select User name.

  2. Enter 1 for points and click Save. Wait for the flow to be saved.

Lab-03 Image

  1. Hit Test to test the flow 👉 Select Manually and click Test again.

  2. Click Continue 👉 Run flow 👉 Done.

Note

The flow run should succeed.

3.4 Run the flow (optional)​

  1. Click on the back button.

Lab-03 Image

  1. Select Cloud flows and open the flow you created.

Lab-03 Image

  1. Start a new browser window and navigate to Power Apps maker portal.
Note

Make sure you are in the correct environment.

  1. Select Apps and launch the PrioritZ Ask application.
The application should now show First Badge.

Lab-03 Image

  1. Go back to flow and run it couple more times.
  2. Go back to the PrioritZ Ask application and refresh the page.
You should now see the Team Player badge.

Lab-03 Image

  1. Go to the flow and run it two more times.
  2. Go back to the PrioritZ Ask application and refresh the page.
You should now see the Champ badge.

Lab-03 Image