ServiceNow Integration with Microsoft PowerApps and Flow
ServiceNow connector to Microsoft PowerApps and Flow is in Preview (Connector Reference). I thought I will give it a try to see how easy that ServiceNow can be integrated into Microsoft Cloud apps. Since there wasn’t much of documentation for this, so I wanted to share my experience here in case someone is interested in the steps:
- How to create a ServiceNow connection in PowerApps
- How to create a Microsoft Flow using the ServiceNow connection
- How to call Flow from PowerApps
How to create a ServiceNow connection in PowerApps/Flow
- Launch Powerapps design Studio and create a New Connection
- Search ServiceNow
- Typing your instance name and username and password.
- I had to connect to the instance with a local account and I wasn’t able connect using my Azure AD account
After the Connection is created, you can use it in Microsoft PowerApps, Flow or Azure Logic Apps. I found Flow is a way better option than connecting directly via PowerApps, since you can easily debug the output in Flow. I think there are limits on how many calls you can make with Flow per month, so you might want to evaluate the cost if you decide to deploy this to production.
How to create a workflow using Microsoft Flow using the ServiceNow connection
- In PowerApps design studio, Go to Business Logic and Click Flows and Create from Blank
- Create a new Action and search for ServiceNow, select ServiceNow – List Records
- Select the record type you want to pull from ServiceNow, such as Requested Item
- Click Test
- Copy the result Array (starting and ending with square brackets) out into notepad. You will need this for creating output JSON Schema.
- Next, add the Request - Response action as the output of the Flow
- This step is necessary and important. I missed this step in my first try so I couldn’t get the response I expected in PowerApps. It just shows ‘True’ value as a return for the Flow in PowerApps. Even when I added this step later, PowerApps still couldn’t pick up the change. I had to recreate a new Flow with Response output and then PowerApps was able to consume the output. I think it is a bug in PowerApps.
- This step is necessary and important. I missed this step in my first try so I couldn’t get the response I expected in PowerApps. It just shows ‘True’ value as a return for the Flow in PowerApps. Even when I added this step later, PowerApps still couldn’t pick up the change. I had to recreate a new Flow with Response output and then PowerApps was able to consume the output. I think it is a bug in PowerApps.
- In Response Body, Click Add dynamic content and select result under List Records panel.
- Click Use sample playload to generate schema and paste the Array from Step 5
- Change Flow name to Request Items
Now you are ready to consume the Flow in PowerApps
How to call Flow from PowerApps
- In PowerApps Studio, create a new app and Select Phone layout under Blank app
- Add a Gallery, Select Blank vertical
- Add a Button and under OnSelect , paste ClearCollect(requests,RequestItems.Run()). This will create a “requests” collection, which then can be hooked into the Gallery control.
- Select the Gallery, and under Items, type requests
- Run the PowerApps, and Click the button, you should get requests back from ServiceNow.
https://www.servicenow.com/community/developer-articles/servicenow-integration-with-microsoft-powerapps-and-flow/ta-p/2320111
