[MUSIC PLAYING] Hello, my name is Mark Rackley, and thank you for joining me for my TEC virtual session on Help! I'm Stuck Supporting the Power Automate Flows My Developer Created.
Now I created this session as a way to show admins what their developers may be doing in Power Automate because, over the years, as Power Automate has grown and gained functionality, it's now becoming that go-to session for workflow automation in Microsoft 365, and more and more developers are adopting the technology.
But because us developers are kind of pesky developers, we're also doing things that, unless you're a developer, you may not quite understand. So the goal of this session is to kind of walk through some of the things that are being done today by your developers in Power Automate so that when you see these things happening in Power Automate, you're better able to understand it, better able to debug it, and maybe even go back to your developers and say, hey, we need you to refactor this to make it a little bit easier for us to deploy.
So our overview today-- we're going to talk about quickly talk about what is JSON because JSON is being used everywhere in Microsoft 365 these days, and it's really pivotal to have a good, solid understanding of where it's used and what exactly JSON is, so should be a quick review over that.
And then we're going to talk about SharePoint REST, and these are endpoints that your developers are using to do advanced functionality from within Power Automate. And there's some really cool stuff you can do with this, so we're going to do some demos on using SharePoint REST within Power Automate it as well.
And then we're going to talk about a really cool functionality that's fairly new. It's called Office Scripts, and we're going to show you how developers are likely executing JavaScript and Typescript from within Power Automate in ways that you did not know of, and all the caveats and gotchas that you're going to have to be aware of if they're using this functionality.
A little bit about me, and then we'll jump in. My name is Mark Rackley. I have got over 30 years now of development and architecture experience. It makes me feel really old to say that, but I've been using SharePoint since 2007, been a Microsoft MVP for the past eight years. I organize my own event in Branson, Missouri. You're all welcome to join next time it's around your time. I'm a blogger, writer, speaker, and yeah, follow me on Twitter @mrackley, and if you have any questions, email me-- mark.rackley@avanade.com.
So let's jump right in. Let's talk about JSON objects. And what are JSON objects? JSON stands for JavaScript Object Notation, and it's used for storing and transporting data. And you'll know you're using a JSON object when you see this structure here, where we have the curly braces to denote that JSON object, and then we have a property with its value here. So this is a very simple, basic JSON object that has a FirstName of Mark and a LastName property of Rackley.
So when you start using JSON and you want to start creating JSON objects, I highly recommend that you download Visual Studio Code-- free tool, and what's great about it is it does syntax checking on your JSON objects. So if there's an error in your JSON object, you'll get the little error indicator. In this instance here, I'm missing a comma after the property FirstName, which is causing the error to occur. Now when you've got JSON objects that are hundreds and hundreds of lines long, it can really, really difficult to debug those, so having a tool like Visual Studio Code is really going to save you a lot of time.
So these JSON objects-- they can also store other JSON objects. In this example here, we have a JSON object that has FirstName, LastName, and Address, and address is JSON object that has the street, city, and state information. So you can really start to get really in depth with these JSON objects because they can keep just being nested further and further down.
You can also store multiple JSON objects in what's called an array. So you'll know you're in an array of JSON objects when you see these square brackets. So in this example, we have an array of objects, and we can see we have one, two, three different objects in this array. And again, this helps us to be able to store multiple JSON objects in one JSON object, and again this can be nested as well. So you can have arrays and arrays and arrays that contain JavaScript and more arrays. So these can just keep getting nested, and it can get pretty nasty if you have to go in there and edit these things.
So when you want to pull data out of these JSON objects, it's important to know how to reference those objects. So if you do have an array of these three objects and you wanted to get the value for the first name of the very first object, you would need to reference that object and use those square braces to say, hey, I'm entering this array, and then you give the index in the array of the object that you want to get. So if you wanted the very first entry, you would do the zero index of that object then do dot and the name of the property. And in this instance, it would return to you "Mark."
Now if you're not a developer, if you're not familiar with indexing, these arrays in the JSON objects are zero-based indexes. That means, even though there's three objects, the very first entry is not entry one. It's entry zero. So you do need to take that into account. And if you're doing things to get