{"id":30948,"date":"2022-03-10T12:33:57","date_gmt":"2022-03-10T07:03:57","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=30948"},"modified":"2022-03-11T14:00:17","modified_gmt":"2022-03-11T08:30:17","slug":"how-to-read-the-current-model-driven-app-details-using-client-api-references","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2022\/03\/how-to-read-the-current-model-driven-app-details-using-client-api-references\/","title":{"rendered":"How to Read the current Model-driven App details using client API references"},"content":{"rendered":"<h2><strong>Introduction:<\/strong><\/h2>\n<p>In a recent project while working on client-side scriptings, we had come across a requirement where we interact with Dynamics 365 CRM data using WebAPI and query expressions. In most cases, we needed the current Model-driven app AppId to build the WebAPI URLs. We had achieved this by using Dynamics CRM Client API references.<\/p>\n<p>With the help of Client API references, we can read the current Model-driven app details. Please find the Client API references below, using which we can get the current Model-driven app details.<\/p>\n<p>1. getCurrentAppProperties<\/p>\n<p>With the use of getCurrentAppProperties client API reference, we can get the current Model-driven app details. Please find the code below:<\/p>\n<pre class=\"lang:css gutter:true start:1\">var globalContext = Xrm.Utility.getGlobalContext();\r\nglobalContext.getCurrentAppProperties().then(\r\n\r\nfunction successCallback (appDetails) {\r\n\r\nalert('App Details found');\r\n\r\n}, function errorCallback() {\r\n\r\nalert('Error');\r\n\r\n});\r\n<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-30956\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/1client-API-reference.jpeg\" alt=\"client API reference\" width=\"349\" height=\"183\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/1client-API-reference.jpeg 349w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/1client-API-reference-300x157.jpeg 300w\" sizes=\"(max-width: 349px) 100vw, 349px\" \/><br \/>\n2. getCurrentAppName<\/p>\n<p>With the use of getCurrentAppName client API reference, we can get the current Model-driven app AppName. Please find the code below:<\/p>\n<pre class=\"lang:css gutter:true start:1\">var globalContext = Xrm.Utility.getGlobalContext();\r\n\r\nglobalContext.getCurrentAppName().then(\r\n\r\nfunction successCallback(appName) {\r\n\r\nalert(appName);\r\n\r\n}, function errorCallback() {\r\n\r\nalert('Error');\r\n\r\n});\r\n<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-30957\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/2client-API-reference.png\" alt=\"client API reference\" width=\"116\" height=\"50\" \/><br \/>\n3. getCurrentAppUrl<\/p>\n<p>With the use of getCurrentAppUrl\u00a0client API reference, we can get the current Model-driven app AppUrl. Please find the code below:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-30958\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/3client-API-reference.jpeg\" alt=\"client API reference\" width=\"566\" height=\"86\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/3client-API-reference.jpeg 566w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/3client-API-reference-300x46.jpeg 300w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/p>\n<h3><strong>Conclusion: <\/strong><\/h3>\n<p>In this way, with the help of Client API references we can easily get details of the current Model-driven app.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/product\/integrations\/inolink-quickbooks-microsoft-dynamics-crm\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone  wp-image-30961\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/inolink.jpg\" alt=\"\" width=\"1028\" height=\"257\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/inolink.jpg 800w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/inolink-300x75.jpg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/inolink-768x192.jpg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/03\/inolink-660x165.jpg 660w\" sizes=\"(max-width: 1028px) 100vw, 1028px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In a recent project while working on client-side scriptings, we had come across a requirement where we interact with Dynamics 365 CRM data using WebAPI and query expressions. In most cases, we needed the current Model-driven app AppId to build the WebAPI URLs. We had achieved this by using Dynamics CRM Client API references.\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2022\/03\/how-to-read-the-current-model-driven-app-details-using-client-api-references\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2354,18,38,2361],"tags":[2575,1194],"class_list":["post-30948","post","type-post","status-publish","format-standard","hentry","category-dataverse","category-dynamics-365-v9-2","category-microsoft-powerapps","category-technical","tag-client-api-references","tag-model-driven-app"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/30948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=30948"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/30948\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=30948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=30948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=30948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}