Formatting Output result for your actions in Custom Connector

Sending
User Review
0 (0 votes)

Continuing with the series on Custom Connector, today I touch upon output results of your actions. If you have worked with any of the existing connectors including Common Data Service connectors, you will notice that when you choose an action like List or Read, the CRM record object returns individual field values of the record as properties that you can then easily use through the Dynamic Values option further in your flow.

When creating a custom connector, say we return a JSON object as the result from the Azure function, you will notice that without any formatting, the output will appear as

Formatting Output result for your actions in Custom Connector

The JSON object is available in the body but to read the individual properties from in there, you would need to use the expression in the form of

outputs(‘GetEmployeeDetail’)?[‘body/FirstName’]

If the JSON result is of the form

Formatting Output result for your actions in Custom Connector

While it is accessible through expression, it would be user friendly if we could have it available as a property that could be referenced directly as a field when listing dynamic values to choose from.

For this make sure to define the response format in your custom connector

Formatting Output result for your actions in Custom Connector

Double click on default to open the response editor

Formatting Output result for your actions in Custom Connector

In the import from sample window provide the JSON object of your result, to see it populate the properties automatically

Formatting Output result for your actions in Custom Connector

With this done, now when you look for the dynamic values for your action result, you will find it in the form of

Formatting Output result for your actions in Custom Connector

Consider scenario where your JSON result is in nested JSON format as below.

Formatting Output result for your actions in Custom Connector

In that if any of the field names is same in the entire JSON object irrespective of whether it is in parent or child node, it will appear as duplicate properties as below.

Formatting Output result for your actions in Custom Connector

Be careful with your properties names in the JSON object to avoid this scenario.

Make sure to set the response properties appropriately for your actions in custom connector to make it more user friendly.