Open utterances-bot opened 2 years ago
I found your article very interesting. I'm still learning JQuery, and I'd say I'm kinda "intermediate". I'm rather intrigued by this line: (window.webapi = window.webapi || {}, jQuery) And what it does - I looked it up and can see its setting a global window variable, but cannot figure out the syntax and the JQuery bit. By the way this question is purely out of curiosity. Your article was very good at explaining what is going on so many thanks for that. Phil
Hi @philcatterall, this a syntax for self invoking function. Take a look at the first line of the wrapper - it is an anonymous function that expect two parameters - webapi and $. At the last line we are just passing those two parameters and calling the function: window.webapi = window.webapi || {} as a webapi parameter, and jQuery global object as $.
Hi OOlashyn, Thanks for your article. How can we access fields from related entities?
Hi @amirzareei, You can expand the OData query to get data from related tables. See https://learn.microsoft.com/en-us/power-pages/configure/read-operations#retrieve-related-tables-by-expanding-both-single-valued-and-collection-valued-navigation-properties for details. Just don't forget to configure relationship as an allowed field in site settings.
Hi OOlashyn, Thanks for your reply. I've done that and I get the result that I want but when I try to access the fields in related entities in JavaScript, It doesn't get the value of address1_line1 but de_name is ok "@odata.context": "api/data/v9.2/$metadata#de_permits(statecode,de_name,de_permitid,de_permitno,new_PortalContactId(address1_line1,address1_city,address1_stateorprovince,address1_postalcode,emailaddress1,websiteurl))", "value": [ { "@odata.etag": "W/\"35651333\"", "statecode": 0, "de_name": "Test", "de_permitid": "0f51454f-d991-ed11-a837-000d3aff4d6a", "de_permitno": "test", "new_PortalContactId": { "address1_line1": "1735 Frobisher Lane,Unit 710", "address1_city": "Ottawa",
Deep dive into Power Apps Portal Web API - Dancing with CRM
Deep dive into Power Apps Portal Web API
https://www.dancingwithcrm.com/powerapps-portal-web-api-deep-dive/