Retrieve Metadata of Global OptionSets from Dynamics 365 in Power Automate | HTTP with Azure AD action

Not sure if you’ll ever need to retrieve the Metadata of Global OptionSets ever or if you’re just curious that this could be retrieved or not, probably this post might be able to help. 😊

Let’s look at how you can retrieve Global Option Set metadata from your Dynamics 365 instance in Power Automate using Invoke and HTTP Request using Azure AD connector.
I’ve mentioned some considerations along the way as well!

Flow

Let’s see how we can retrieve the Global Option Sets from your D365 instance –

  1. For simplicity, my Flow will run on-demand. Hence, the next step is to have HTTP with Azure AD connector to be used.
    Consideration: The reason we are not using Dataverse connector is because it doesn’t let you Retrieve / Retrieve Multiple on GlobalOptionSetDefinitions which is required in this case.
    And you’ll be using HTTP Request to retrieve resources from your current D365 environment and hence, will use Connection Reference based on who can access the APIs.



  2. Now, in the Invoke HTTP Request with Azure AD, use the below to query the GlobalOptionSetDefinitions


  3. Further, once this is executed, the Output of the request will be a JSON response which is tremendously huge and detailed.
    So, when I format it in an online formatter, it looks something like this –


  4. Consideration: $filter= is not supported in this type Request. Hence, it won’t work and you’ll get the below error. Below is an example when I tried –




  5. So, after referring to #3 above
    Now, once you have retrieved this data, we’ll use Filter array action in Power Automate to filter the OptionSet Metadata based on the the Name of the OptionSet and select that piece of JSON which contains the details of 1 single Option Set

  6. Now, in Select, we’ll select the Value part of the Body of the HTTP Request we’ve used above.
    body(‘Invoke_an_HTTP_request’)?[‘value’]
    And the reason we select value is because from the Body of the step above, we are selecting the Value array which is an Option Set record itself.
    Further, we’ll use a criteria to Filter the same.


    And if you Peek Code this and see


  7. Next, the criteria we’ll use to filter is based on the name of the Option Set itself which you can easily see in Dynamics 365.
    We’ll pick item()[‘Name’] to select the JSON attribute whose value we want to compare on the right hand side


    And if you Peek Code here

  8. Now, the reason we chose this is in #3 above, if you expand, you’ll see the Name JSON attribute that contains your Unique Name of the OptionSet.


  9. And now, when you Run the Flow and see the Result of the last Filter Array Step


    And if you take these Outputs and Beautify to see the structure, you’ll see that this is 1 Option Set’s Metadata. You can then see these values if you ever need to retrieve the Global Option Sets at any point.

Here are some more Power Automate / Flow posts you might want to check –

  1. Primary Key of Activity type entity in a Dataverse connector in Power Automate | Quick Tip
  2. Split On in Power Automate in SharePoint trigger for Item updates
  3. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  4. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  5. Invalid XML issue in Dataverse connector for List Rows action | Fetch XML Query | Power Automate
  6. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  7. Invalid type. Expected Integer but got Number error in Parse JSON – Error at runtime after generating Schema | Power Automate
  8. Asynchronous HTTP Response from a Flow | Power Automate
  9. Converting JSON to XML and XML to JSON in a Flow | Power Automate
  10. FormatDateTime function in a Flow | Power Automate

Thank you!

Advertisement

Visualize Adaptive Card for Teams user action within a Cloud Flow | Experimental Feature

Microsoft Teams’ connector for Cloud Flows (Power Automate), and if you are looking to use Adaptive Cards for Microsoft Teams from the connector. There are chances that you’ll see some options to post an Adaptive Cards to Teams.

I’m exclusively covering a Teams’ connector’s Action called as Post an Adaptive Card to a Teams user and wait for a response.

But, you also have an improved Adaptive Cards Action in the Microsoft Teams’ connector that let’s you save the progress of the Card in the Flow itself!

Also, I found this effective for only 1 Action from the Microsoft Team’s Adaptive Card related actions. Not others.

Adaptive Card to Teams User – Regular

So, if you see the below –

With the above Adaptive Card, you’ll need to work in https://adaptivecards.io/ and paste the Card payload here and then save it. Also, you can’t visualize it within the Flow step itself.

Turn on Experimental Features for Flow

  1. Look for the Gear icon in Settings and look for All Power Automate Settings


  2. If the Experimental Features show below is turned Off, please turn it on.

Adaptive Card with Experimental Features On

  1. Now, if you select the same Action from the Power Automate step

  2. You’ll see the Step Action having the below details.


  3. Once you click on Create Adaptive Card, you’ll see the Designer itself in the Flow Steps which you can create the Card on the fly within the Flow and save the same as well.


    Hope this helps!!

Here are some more Power Automate posts you might want to look at –

  1. FormatDateTime function in a Flow | Power Automate
  2. Formatting Approvals’ Details in Cloud Flows | Power Automate
  3. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  4. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  5. Save Adaptive Cards work using VS Code Extension – Adaptive Cards Studio | Quick Tip
  6. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  7. Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
  8. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  9. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
  10. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate

Thank you!!