Read related record information using Get Query in WEB API in Power Automate HTTP Action Dataverse

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] welcome to another video in this video I will tell you how we can connect a dataverse environment and extract or retrieve the record information using HTTP action in power automatic Plus whenever we are retrieving data we also want to retrieve the related entity information in that same call Web API call for example let's say I want to read loan records okay this is my loan entity and I have loan records and in every loan record we have a customer lookup right and this is a customer lookup and this is a polymorphic lookup it's not a single entity lookup it is it may point to contact it may point to account now I want to read loan information plus the customer's information also the customers email address and name if it is account I want account name and email address if it is contact I want contact full name and email address and other information of that related entity so how we can read that in power automate right so this is my power automate I have taken a instant trigger you can take any trigger of your choice and I have taken HTTP action right here you can choose HTTP and choose that action and once you choose this action you can choose select the action and choose the method method I have created that and given my web API URL get method this is my web API URL where can you get this web API URL you can get this in powerapps right if you go to make dot powers powerapps and go to developer resources you will get that web API endpoint so this is the over data this is the rest endpoint we have a pay endpoint available in all environments now after this web API endpoint link you have to give the entity set or table set if you go to any table you can find out the set by using tool option and you can copy the name of the entity set and paste here then you have to provide the headers information or data version Max person content type application Json and prefer Edge or data include annotation this is the last prefer header option is used to get the formatted values of uh complex data types for example Choice means normally if you retrieve Choice it Returns the value but if you want the text of the choice you need this prefer option so that it will return the formatted value in the response and most importantly important is the expand query right expand query where we have to pass what related entity you want to read right what related entity you want to read you have to pass here like this expand the relationship name and the dollar select equal to so this how how can you know that this should be uh the customer underscore account and another is the customer underscore contact actually the customer lookup in the loan entity May connect to contact or main connect to account that's why I have written two uh up two option in x x expand uh query if account is associated read using select read name and email address comma if it is contact read full name and email address using comma I have given this expand option now how to understand whether this what to write here is this a course is this a relationship name or something else you can understand after you run it let me test this run it and if you run the flow and click on done you will see in the HTTP response body part you will see just scroll down you can see here there is option called Edge navigation property right this Associated navigation property will give you the navigation property that you can use in web API to fetch a related lookup entity information here this is an account that's why I have passed this information in my expand query and supplied which columns I want to read right like that in the contact if you go to another record you will see that contact in the associated property this is for business unit let me go to customer information yes this one so this record is having contact Association right that's why the association Associated navigational property is this one that's why I passed this and the account lookup is associated it will return account data if it is associated contact it will return contact data and how it is returning you can see here so for the first record it is returning customer account name email address and account ID in my second record so for the first record contact navigation properties in all because the first record is associated with a account right this is associated with an account and this is associated with a contact the customer lookup that's why here we will see the first record customer contact navigation property known but customer wanted account navigation property returns data in the second record the customer uh the customer account navigation is null Associated navigation properties and all but customer contact is returning data right so this is how you can read uh related entity information like a parent entity information in using expand query in your web API URL right you understand how it is done extracting information is very easy a simple information let's say I want to extract some information like if I'll go to add a select query select you can use select right select let's say I want to read a script and name and I want to read amount and I want to read customer value right so this is the lookup uh field so let me run it and in addition to the select you can get expand you can also use expand so that it will select this rig this uh field information from this loan plus it will expand or it will return the related customer information also in that same query you can test this if you have supplied wrong field name then it will through error it will throw error because it is telling that it is not found now how to check that what is the name of this URL name of this field just remove this for now and run it without giving the selection Builder to identify what is the name of the lookup field that returns now go to body part and here if you scroll down you will see the name of your column you see this one so you copy this this is the lookup field so I want to select the first attribute is name then amount then this this is the look of it now if you directly return directly read this lookup field it will just return the guid but it will not return the name of the name of the lookup field but as because we have used this data annotation it will return the name of the lookup also with ID but you cannot uh read more information about the lookup field value like if it is connected to contact you want to read more information about that contact without using expand so you have to use expand if you want to deeply connect to the lookup value entity and read more data now let us test this how it works so in the select command I have used the three values name amount and customer value now it is telling HTTP amount okay amount field is having some issue I have done something wrong here yes underscore should not be there in the amount so you have to correctly specify their name field field names otherwise it will throw error right now if you go to check the body the first record is started and it is reading the name and the amount you see amount fermented value is also given using the symbol dollar symbol or currency symbol 5 because we have used this prepare annotation otherwise it will not return this thing will you will not get you will just get the value the amount value that's it so in addition to this you will also get the customer value and customer type customer lookup type it is connecting to account entity it is this is the associated navigational property and this is the name of the lookup field and value also g y d of the lookup and the current uh primary key and the navigation are associated and lookup property information right so this is how you can read related information using exponent this is very important we use most of the times in our projects thank you everyone I hope you learn something how to connect HTTP request from your power automate connecting to any data first and remember you have to authenticate to connect this Azure directory oauth authentication which request an antid audience you know and client ID client credential Secret otherwise you cannot connect this web API endpoint thank you guys I hope you learned something please subscribe this channel if you have not done I'll come with new videos next time thanks [Music]
Info
Channel: Softchief Learn
Views: 3,389
Rating: undefined out of 5
Keywords: Dynamics, CRM, Dynamics 365, Power Apps, d365, power platform, dynamics 365 tutorials, dynamics crm training, webapi dataverse, webapi end point dynamics 365, dynamics 365 web api calls, http get dataverse call, power autoamte http action
Id: KKzhfJQZCgo
Channel Id: undefined
Length: 11min 57sec (717 seconds)
Published: Sat Jul 23 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.