Pulling data from web via REST BPM

What happens if you read the SLID variable instead?

I’m going to try a code up an example for you, brb

Here’s a crappy example of how your string response from the web service is being returned and parsed by the JsonConvert.DeserializeObject. In your case, you have 1 set of records, but if you had multiple, you could iterate over them like so, or access them by position.

using System;
using Newtonsoft.Json;

public class Program
{
	public static void Main()
	{
		string responseValues =@"[{'Target_Delivery_Date':'2021-01-18','SLID': '202011-WRKAf','OppId':'0065G00000WRKAfQAP'}]";

		dynamic foo = JsonConvert.DeserializeObject(responseValues);
		
		//shows the string as a json array
		Console.WriteLine(foo);		
		
		//iterate over the dynamic content
		foreach(var item in foo)
		{
			Console.WriteLine("Target Delivery Date " + item.Target_Delivery_Date);
			Console.WriteLine("SLID " + item.SLID);
			Console.WriteLine("OppID " + item.OppId);
		}
		
		//Or, access the object by name/index
		Console.WriteLine("Target Delivery Date " + foo[0].Target_Delivery_Date);
		
	}
}

Results:
image

1 Like