Search code examples
dynamics-crmdynamics-crm-onlinepower-automate

Power automate Http request body as RemoteExecutionObject, How to retreive particualr field from Input argument


I have Power automate which run as webhook to dynamics i.e Trigger is HTTP request.

Once this request run it contains body as RemoteExecutionObject.

Example below

{
  "BusinessUnitId": "eedd1dcd-1318-e611-80d3-005056936c69",
  "CorrelationId": "8385868f-4fa4-42a0-9c83-6b63a5cd4774",
  "Depth": 2,
  "InitiatingUserAzureActiveDirectoryObjectId": "00000000-0000-0000-0000-000000000000",
  "InitiatingUserId": "91ff1dcd-1318-e611-80d3-005056936c69",
  "InputParameters": [
    {
      "key": "Target",
      "value": {
        "__type": "Entity:http://schemas.microsoft.com/xrm/2011/Contracts",
        "Attributes": [
          {
            "key": "crm_abc",
            "value": null
          },
......
......
}

I wish to retrieve particualr field and it's value from InputParameetrs in Power automate.

Here is one close to example mentioning how it can be achieved. But it is still not clear

Does any one have idea about the same.


Solution

  • solved this particular challenge with variables and using array/object one at a time.

    for ex: First retrieved InputParameters as array from Json

    triggerBody()['InputParameters']
    

    then used index 0 so that I get complete InputParameters as object

     triggerBody()['InputParameters'][0]
    

    Then to get Values Array as below

    triggerBody()['InputParameters'][0]['value']['Attributes']
    

    and then attributes as Array

    triggerBody()['InputParameters'][0]['value']['Attributes']
    

    Note we can directly retrive Attributes with above expression.

    Now to get particular field from Attributes array, I used filter array action from power automate and used it as

    Similar way we can retrive various fields

    enter image description here