Getting Started with Microsoft Power Apps with IFS Cloud

Microsoft is dominating the enterprise low-code application platforms [1] and there are immense possibilities on how we can use power platform in businesses. IFS Cloud enables accessing the business logic through REST APIs so it’s easy Extend on the Outside using low-code development platforms like PowerApps.

Power platform offers many inbuilt connectors but so far, IFS has not released an official connector for PowerApps. This does not limit the possibility of connecting IFS with Power Apps since we can create a custom connector for our needs and fetch the data using REST APIs.

In this post, we’ll discuss on how to create a simple mobile app using PowerApps which uses IFS Cloud as the backend, some key considerations when developing PowerApps and few tips when working with IFS APIs.

Microsoft Power Apps documentation is a good starting point to setting up everything you need to develop on PowerApps. If you are new to PowerApps, it’s better to spend some time on reading the concept and setting up PowerApps for developments.

In this article we’ll discuss following topics.

  1. IFS Projections and Custom Connector
  2. Create IAM client for Authentication
  3. Creating the Custom Connector
  4. Creating the PowerApps mobile App

IFS Projections and Custom Connector

Key component of connecting PowerApps to IFS is the custom connector. A custom connector is a wrapper around a REST API that allows Logic Apps, Power Automate, or Power Apps to communicate with 3rd party APIs.

In IFS terms, a Projection is equivalent to a REST API and you can find all the information about the API operations through API Explorer in IFS Cloud. As I have experienced so far, there has to be one PowerApps connector for each projection and you can’t have a generic connector serving multiple projections. If you have a different opinion or found a way to connect several projections into one PowerApps custom connector, please mention that in the comments.

There are two ways to create the custom connector for an IFS projection.

  • Build the custom connector using the OpenAPI specification which can be found in API explorer
  • Identify the projection calls you need for the integration and build the connector from scratch

OpenAPI specification for an IFS projection is usually heavy with many API operations and I ended up getting the PowerApps connector non-responsive or getting errors due to it exceeding maximum allowed number of operations [2] when trying to create the custom connector with Projection OpenAPI specification. Therefore I recommend creating the connector from the scratch. By this way we would have more control over the connector design and have a light-weight connector only serving our requirement.

In order to create the custom connector, we should know which IFS API projection operations, request and response samples and HTTP headers if any. In this example, I’m planning to create a simple PowerApps App where a user can search a Master Part by part by description and get the details.

As the first step, we can simulate what we need in our app in IFS Cloud to find the information we need.

  • Go to the Part Master data > Master Part > Part page in IFS Cloud. Open the log window and keep it in a side.
  • Search on part description and fetch the records
  • Go to the log window and find the relevant HTTP call to fetch the data.
HTTP call for search on description

Tip: My preferred way is to create a Postman collection and test things before start building the PowerApps custom connector. By this way it’s possible to know all the information we needed for building the connector and additionally it’s a good way to test and troubleshoot the IFS integration without going through the PowerApps.

You can also find the request and responses, HTTP verb and headers using the log window. Save these since we need it when creating the custom connector.

Create IAM client for Authentication

Now we have identified the API operations we need to build the connector. Next step is to create the IAM client in IFS Cloud for authentication. More information on authentication in IFS cloud can be found in my previous article Authentication in IFS Cloud.

We are building an app for IFS end users, where a user must authenticate with IFS for using the app. This can be done by using the End User Authentication (Authorization Code Flow).

Go to IFS Cloud > IAM Client Details, create a new client. Give a client ID, description and save.

Keep the Redirect Uri blank for now. We will fill this after creating the custom connector. Copy the secret after creating the IAM client to be used in the PowerApps connector.

Creating the Custom Connector

Now we’ll get into the Power platform and start building up. There are several ways of creating a custom connector and I’m using the easiest and the rookie-friendly way here 😊

Microsoft documentation: Create a custom connector from scratch

Go to the PowerApps environment and in the left panel, go to More > Discover All

On the discover page, you could see the link to custom connector inside the Data card.

On the New custom connector dropdown, select Create from blank.

As you have noticed, there are several options to create the connector and if you would like to try to create connector using OpenAPI specification, you can do that by choosing the Import an OpenAPI file option and using the Projection OpenAPI specification which can be downloaded from IFS API explorer.

Give a name for custom connector and in the wizard, enter the host and path to the projection in the General Information

In the Security step, choose OAuth 2.0 as authentication type.

Fill the client ID and secret from the IAM client which we created above. Enter the Authorization, Token and Refresh URLs. If you don’t know how to find those, refer my previous blog post.

In the Definitions step, you can add the API operations for the connector.

We have only one operation in our connector, which is to search part by description

Operation ID: PartCatalogSetSearch

Request: Use Import from sample and paste the projection call to search part by description.

Eg:

Verb: GET

URL:

https://your-ifs-host/main/ifsapplications/projection/v1/PartHandling.svc/PartCatalogSet?$filter=(startswith(tolower(Description),'mf'))

In the Response section, use add default response and paste a sample response from above request which copied from the debug console or from projection API documentation.

Now press the Create connector on the wizard to finish the setup.

Upon creating the connector, it will reveal the Redirect URL in the security tab. copy that and add as Redirect Uri in IFS IAM client created above

Now it’s time to test our connector. Go to the Test tab and Create a New connection. If everything is setup correctly, you will be directed to IFS login screen. enter credentials and create a new connection. Use the same filter condition and see if you can see the response.

Creating the PowerApps mobile App

Now it’s time to create the app. I’m creating a Canvas App with a gallery and not going into details on how to create the app since there are tons of material can be found to create power apps.

On the Data section, select the connector we created and add as a data source.

My App has a Text Input to enter the part description, a search button and a vertical gallery to show the response data.

In the Button function, I’m calling the PartCatalogSetSearch operation in the custom connector and put the response in a collection named partCatalogCollection.

Button function:

ClearCollect(partCatalogCollection, 'IFS-PartHandling'.PartCatalogSetSearch({'$filter':"(startswith(tolower(Description),'" & TextInput1.Text & "'))"}).value)

Set the data source of the vertical gallery to partCatalogCollection and then you can add fields from the result set.

Now it’s time to test the app in action!

Save, and Preview the app (F5). Change the layout to mobile to see the real feeling of your app 🙂

Once the app is completed, it’s possible to Publish and distribute to the others.

Hope you enjoyed reading the post and have learned the basics of connecting IFS with PowerApps. Please leave your thoughts in the comments and share among others!

References

  1. Magic Quadrant | Microsoft Power Apps
  2. Custom Connectors: Maximum allowed number of operations (256)

9 thoughts on “Getting Started with Microsoft Power Apps with IFS Cloud

Add yours

  1. Hi Damith, thanks for really helpful post! What kind of approach would you use for PowerBi and IFS integration? I tried using OData Feed connector with no luck, but I managed to get the data using Web connector. Would you recommend to create a custom connector?

    1. Hi Zuck,

      PowerBI OData connector won’t help since it cannot handle OAuth2 authentication aside AzureAD.
      As you may have already found, one option is to create a custom connector
      Following article will help you to
      https://learn.microsoft.com/en-us/power-query/handling-authentication#implementing-an-oauth-flow

      Otherwise, I have tried a quick and dirty hack using Azure API management to overcome this. Here’s what I did in a nutshell.
      1. Created an Azure API for an IFS projection
      2. Authenticated the incoming request using a policy (used this policy as a guideline: https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Backend%20OAuth2%20Authentication%20With%20Cache.policy.xml)
      3. Used the Azure API in the OData feed in PowerBI

      By this way, I could connect PowerBI but the limitation is that you can connect only with a service user. If you are interested about the topic, put a comment. I’ll try to write something on that 🙂

      1. Hi Damith,

        Thanks a lot for your response. I would definitely love to see a guide from you about connection between IFS and Power BI.

        Just want to clarify: For Inbound rule, in that XML file do I need to change the end-points to IFS to get IFS token? And where did you initialize parameters like “authorizationServer” or “clientID”? Directly in the XML?

      2. For step 1: Created an Azure API for an IFS projection
        What type of Azure API did you use? OData or HTTP?

Leave a comment

Website Powered by WordPress.com.

Up ↑