cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LukePWilkins
Helper II
Helper II

Dataverse - List Rows - Handle Result

Hello there. 

I perform a successful List Row (dataverse) action in my flow, with a Odata search criteria that works and returns the single row with the information I'm after. Then I get lost with how to handle the result and extract the two column values i'm after.  Below is a copy of the result, all I need to extract and use in a HTTP API call is "cr953_jobid": "ID_I_NEED_TO_USE", "cr953_jobname": "THE_NAME_OF_THE_JOB",

How do I achieve that please?

Cheers

Luke

 

{
	"statusCode": 200,
	"headers": {
		"Vary": "Accept-Encoding",
		"x-ms-service-request-id": "a665e70e-0eae-4433-8a4f-160079cbf697,7b19f289-d042-4559-aa7b-b190e1d8392a",
		"Cache-Control": "no-cache",
		"Set-Cookie": "ARRAffinity=ebd1cd1c8bc252fb361c8eda8598254cacbc7dca82fd4c42f359af54dee6fcd9; domain=domain.crm6.dynamics.com; path=/; secure; HttpOnly,ReqClientId=b2e76ffa-7dee-4017-91d3-376bb546d552; expires=Fri, 12-Jun-2071 05:59:41 GMT; path=/; secure; HttpOnly; samesite=none,ARRAffinity=ebd1cd1c8bc252fb361c8eda8598254cacbc7dca82fd4c42f359af54dee6fcd9; domain=domain.crm6.dynamics.com; path=/; secure; HttpOnly",
		"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
		"REQ_ID": "7b19f289-d042-4559-aa7b-b190e1d8392a",
		"AuthActivityId": "9b7210fd-1f7d-4618-b6dd-4e171e1f8a96",
		"x-ms-ratelimit-time-remaining-xrm-requests": "1,199.34",
		"x-ms-ratelimit-burst-remaining-xrm-requests": "5998",
		"OData-Version": "4.0",
		"Preference-Applied": "odata.include-annotations=\"*\"",
		"X-Source": "1911481206875379911755108208363599121284017359153113125191366137711603811515058,141981412692311605614181108809716411228311631302501642191091882092322471741452390",
		"Public": "OPTIONS,GET,HEAD,POST",
		"Timing-Allow-Origin": "*",
		"Date": "Sat, 12 Jun 2021 05:59:40 GMT",
		"Allow": "OPTIONS,GET,HEAD,POST",
		"Content-Type": "application/json; odata.metadata=full",
		"Expires": "-1",
		"Content-Length": "730"
	},
	"body": {
		"@odata.context": "https://orgc9bd3046.crm6.dynamics.com/api/data/v9.1/$metadata#cr953_workflowmaxes(cr953_jobid,cr953_jobname)",
		"@Microsoft.Dynamics.CRM.totalrecordcount": -1,
		"@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded": false,
		"value": [
			{
				"@odata.type": "#Microsoft.Dynamics.CRM.cr953_workflowmax",
				"@odata.id": "https://domain.crm6.dynamics.com/api/data/v9.1/cr953_workflowmaxes(cf5033a4-c9c8-eb11-bacc-00224817f386)",
				"@odata.etag": "W/\"1142967\"",
				"@odata.editLink": "cr953_workflowmaxes(cf5033a4-c9c8-eb11-bacc-00224817f386)",
				"cr953_jobid": "ID_I_NEED_TO_USE",
				"cr953_jobname": "THE_NAME_OF_THE_JOB",
				"cr953_workflowmaxid@odata.type": "#Guid",
				"cr953_workflowmaxid": "cf5033a4-c9c8-eb11-bacc-00154817f386"
			}
		]
	}
}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
vikulkar
Community Support
Community Support

Hi @LukePWilkins,

 

It should be possible to parse the JSON content by adding a Parse JSON action and adding the body payload:

 

{
"@odata.context": "https://orgc9bd3046.crm6.dynamics.com/api/data/v9.1/$metadata#cr953_workflowmaxes(cr953_jobid,cr953_...)",
"@Microsoft.Dynamics.CRM.totalrecordcount": -1,
"@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded": false,
"value": [
{
"@odata.type": "#Microsoft.Dynamics.CRM.cr953_workflowmax",
"@odata.id": "https://domain.crm6.dynamics.com/api/data/v9.1/cr953_workflowmaxes(cf5033a4-c9c8-eb11-bacc-00224817f...)",
"@odata.etag": "W/\"1142967\"",
"@odata.editLink": "cr953_workflowmaxes(cf5033a4-c9c8-eb11-bacc-00224817f386)",
"cr953_jobid": "ID_I_NEED_TO_USE",
"cr953_jobname": "THE_NAME_OF_THE_JOB",
"cr953_workflowmaxid@odata.type": "#Guid",
"cr953_workflowmaxid": "cf5033a4-c9c8-eb11-bacc-00154817f386"
}
]
}

 

vikulkar_0-1623617519993.png

Pass the body value as the input parameter and then you can use the below expression to retrieve any property value by using the expression: 

For eg: body('Parse_JSON')?['value']?[0]?['cr953_jobname']

 

View solution in original post

7 REPLIES 7
vikulkar
Community Support
Community Support

Hi @LukePWilkins,

 

It should be possible to parse the JSON content by adding a Parse JSON action and adding the body payload:

 

{
"@odata.context": "https://orgc9bd3046.crm6.dynamics.com/api/data/v9.1/$metadata#cr953_workflowmaxes(cr953_jobid,cr953_...)",
"@Microsoft.Dynamics.CRM.totalrecordcount": -1,
"@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded": false,
"value": [
{
"@odata.type": "#Microsoft.Dynamics.CRM.cr953_workflowmax",
"@odata.id": "https://domain.crm6.dynamics.com/api/data/v9.1/cr953_workflowmaxes(cf5033a4-c9c8-eb11-bacc-00224817f...)",
"@odata.etag": "W/\"1142967\"",
"@odata.editLink": "cr953_workflowmaxes(cf5033a4-c9c8-eb11-bacc-00224817f386)",
"cr953_jobid": "ID_I_NEED_TO_USE",
"cr953_jobname": "THE_NAME_OF_THE_JOB",
"cr953_workflowmaxid@odata.type": "#Guid",
"cr953_workflowmaxid": "cf5033a4-c9c8-eb11-bacc-00154817f386"
}
]
}

 

vikulkar_0-1623617519993.png

Pass the body value as the input parameter and then you can use the below expression to retrieve any property value by using the expression: 

For eg: body('Parse_JSON')?['value']?[0]?['cr953_jobname']

 
LukePWilkins
Helper II
Helper II

Really appreciate the reply! I had gone down the Parse JSON path with some success, but always found myself dealing with an array output, which was throwing me! However I tried, I ended up with an array!!

 

The syntax in bold is probably what I need... i thank you in advanced and will try it later today!

LukePWilkins
Helper II
Helper II

@vikulkar , i tested it! Works a treat. You are amazing! Thank you. 

I've learned a heap attempting this project of mine... that syntax to retrieve individual values will stay with me forever!

 

cheers so much

vikulkar
Community Support
Community Support

Thanks @LukePWilkins , Glad to know that this helped.

 

Please do accept it as a solution / give it a thumbs up, as this can help others as well 🙂

 

Thanks and Regards,

  Vikas K

LukePWilkins
Helper II
Helper II

For reference, would it be possible to explain, how body('Parse_JSON')?['value']?[0]?['cr953_jobname'] 

works? Explain the syntax maybe and how it all fits together please

 

regards

vikulkar
Community Support
Community Support

Sure,

All we are doing here is referring the value property which is an array of objects and since it is an array, 

We need to mention which object to refer, in the whole array of objects.

Because you had mentioned earlier that your output would always return a single object so the index will always be [0] (Suppose your output returns 2 rows then [1] would have returned the information of the second row)

Finally, the ['cr953_jobname'] will tell which property in that object needs to be returned. In the above eg it is: ID_I_NEED_TO_USE

 

Hope that helps..

 

 

LukePWilkins
Helper II
Helper II

Thank you for that. My knowledge is expanding every day! This forum is a great resource

cheers

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,813)