{"id":35358,"date":"2023-07-11T15:28:15","date_gmt":"2023-07-11T09:58:15","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=35358"},"modified":"2023-07-13T18:25:52","modified_gmt":"2023-07-13T12:55:52","slug":"how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/","title":{"rendered":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?"},"content":{"rendered":"<p>We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being created in the background in the format of \u201cprefix_fieldSchemaName_OOBEntitylogicalName_OOBEntityLogicalName\u201d.<\/p>\n<p>Since we wanted it to be in the format of \u201cprefix_fieldSchemaName_OOBEntityLogicalName\u201d, we started looking at it at the code level. Since we were creating the relationship through C# code, we started looking through two metadata requests \u2013<\/p>\n<ul>\n<li>LookupAttributeMetadata<\/li>\n<li>OneToManyRelationshipMetadata<\/li>\n<\/ul>\n<p>After a few trials and errors, we created the relationship with the name in the format we wanted, and below are the steps to achieve it.<\/p>\n<p>Firstly, we need to add the IsCustomizable property to our LookupAttributeMetadata with the value a new BooleanManagedProperty with the value as true.<\/p>\n<pre class=\"lang:css gutter:true start:1\">\/\/ Create a new instance of BooleanManagedProperty\r\nBooleanManagedProperty boolManagedProperty = new Microsoft.Xrm.Sdk.BooleanManagedProperty();\r\n\r\nboolManagedProperty.Value = true;\r\n\r\ncreateMultilookupField.Parameters[\"Lookup\"] = new LookupAttributeMetadata()\r\n\r\n{\r\n\r\nSchemaName = fieldSchemaName,\r\n\r\nDisplayName = new Label(fieldDisplayName, languageCode),\r\n\r\nIsCustomizable = boolManagedProperty,\r\n\r\nDescription = new Label(description, languageCode)\r\n\r\n};<\/pre>\n<p>After the change in LookupAttributeMetadata request, we need to add the ReferencingEntityNavigationPropertyName property to our OneToManyRelationshipMetadata request, as shown below \u2013<\/p>\n<pre class=\"lang:css gutter:true start:1\">\/\/create variable for onetomanyrelationship metadata.\r\nvar lookupFieldcreated = new OneToManyRelationshipMetadata\r\n\r\n{\r\n\r\n\/\/entity on which this field should be created\r\n\r\nReferencingEntity = referencingEntityName,\r\n\r\n\/\/entity with which relationship should be created\r\n\r\nReferencedEntity = logicalNameofEntity,\r\n\r\nSchemaName = relationshipSchemaName,\r\n\r\nReferencingEntityNavigationPropertyName = fieldSchemaName + \"_\" + logicalNameofEntity,\r\n\r\n};<\/pre>\n<p>So, after adding these two properties, the whole code to create the polymorphic attribute with a custom Referencing Entity Navigation Property Name becomes as below \u2013<\/p>\n<pre class=\"lang:css gutter:true start:1\">OrganizationRequest createMultilookupField = new OrganizationRequest\r\n{\r\n\r\nRequestName = \"CreatePolymorphicLookupAttribute\"\r\n\r\n};\r\n\u00a0\r\n\r\n\/\/ Create a new instance of BooleanManagedProperty\r\n\r\nBooleanManagedProperty boolManagedProperty = new Microsoft.Xrm.Sdk.BooleanManagedProperty();\r\n\r\n\r\nboolManagedProperty.Value = true;\r\n\r\n\r\ncreateMultilookupField.Parameters[\"Lookup\"] = new LookupAttributeMetadata()\r\n\r\n{\r\n\r\nSchemaName = fieldSchemaName,\r\n\r\nDisplayName = new Label(fieldDisplayName, languageCode),\r\n\r\nIsCustomizable = boolManagedProperty,\r\n\r\nDescription = new Label(description, languageCode)\r\n\r\n};\r\n\r\n\/\/create variable for onetomanyrelationship metadata.\r\n\r\nvar lookupFieldcreated = new OneToManyRelationshipMetadata\r\n\r\n{\r\n\r\n\/\/entity on which this field should be created\r\n\r\nReferencingEntity = referencingEntityName,\r\n\r\n\/\/entity with which relationship should be created\r\n\r\nReferencedEntity = logicalNameofEntity,\r\n\r\nSchemaName = relationshipSchemaName,\r\n\r\nReferencingEntityNavigationPropertyName = fieldSchemaName + \"_\" + logicalNameofEntity,\r\n\r\n\r\n};\r\n\r\n\r\ncreateMultilookupField.Parameters[\"OneToManyRelationships\"] = new OneToManyRelationshipMetadata[] { lookupFieldcreated };\r\n\r\nconfig.Service.Execute(createMultilookupField);<\/pre>\n<h2>Conclusion<\/h2>\n<p>This is how we can create a custom referencing entity navigation property name by setting the IsCustomizable &amp; LookupAttributeMetadata properties.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/services\/\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone size-full wp-image-35375\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif\" alt=\"\" width=\"700\" height=\"200\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/\">Read More: How can I set the Navigation Property name for a\u2026 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,19],"tags":[2082],"class_list":["post-35358","post","type-post","status-publish","format-standard","hentry","category-dynamics-365-v9-2","category-dynamics-crm","tag-lookup-field"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Inogic\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta property=\"og:description\" content=\"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif\" \/>\n\t\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2023-07-11T09:58:15+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2023-07-13T12:55:52+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inogicindia\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta name=\"twitter:description\" content=\"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif\" \/>\n\t\t<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t\t<meta name=\"twitter:data1\" content=\"Inogic\" \/>\n\t\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#blogposting\",\"name\":\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks\",\"headline\":\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?\",\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/sarika\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#articleImage\",\"width\":700,\"height\":200},\"datePublished\":\"2023-07-11T15:28:15+05:30\",\"dateModified\":\"2023-07-13T18:25:52+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#webpage\"},\"articleSection\":\"Dynamics 365 v9, Dynamics CRM, lookup field\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-365-v9-2\\\/#listItem\",\"name\":\"Dynamics 365 v9\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-365-v9-2\\\/#listItem\",\"position\":2,\"name\":\"Dynamics 365 v9\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-365-v9-2\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#listItem\",\"name\":\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#listItem\",\"position\":3,\"name\":\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/dynamics-365-v9-2\\\/#listItem\",\"name\":\"Dynamics 365 v9\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"By Inogic\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/inogic-logo.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#organizationLogo\",\"width\":1000,\"height\":325,\"caption\":\"inogic logo\"},\"image\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/inogicindia\",\"https:\\\/\\\/twitter.com\\\/inogic\",\"https:\\\/\\\/www.instagram.com\\\/inogicindia\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCM4V7ousgLSu1hbOEv4DUuQ\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/inogicindia\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/sarika\\\/#author\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/sarika\\\/\",\"name\":\"Inogic\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7e3157d3c9d28231b0a67ff18cc6445c87e889473ae03080f7026c5482ce860?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Inogic\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#webpage\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/\",\"name\":\"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2023\\\/07\\\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/sarika\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/sarika\\\/#author\"},\"datePublished\":\"2023-07-11T15:28:15+05:30\",\"dateModified\":\"2023-07-13T18:25:52+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"alternateName\":\"Inogic\",\"description\":\"By Inogic\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks","description":"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being","canonical_url":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#blogposting","name":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks","headline":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?","author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/sarika\/#author"},"publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#articleImage","width":700,"height":200},"datePublished":"2023-07-11T15:28:15+05:30","dateModified":"2023-07-13T18:25:52+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#webpage"},"isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#webpage"},"articleSection":"Dynamics 365 v9, Dynamics CRM, lookup field"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.inogic.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-365-v9-2\/#listItem","name":"Dynamics 365 v9"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-365-v9-2\/#listItem","position":2,"name":"Dynamics 365 v9","item":"https:\/\/www.inogic.com\/blog\/category\/dynamics-365-v9-2\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#listItem","name":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#listItem","position":3,"name":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?","previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/dynamics-365-v9-2\/#listItem","name":"Dynamics 365 v9"}}]},{"@type":"Organization","@id":"https:\/\/www.inogic.com\/blog\/#organization","name":"Microsoft Dynamics 365 CRM Tips and Tricks","description":"By Inogic","url":"https:\/\/www.inogic.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/02\/inogic-logo.png","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#organizationLogo","width":1000,"height":325,"caption":"inogic logo"},"image":{"@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/inogicindia","https:\/\/twitter.com\/inogic","https:\/\/www.instagram.com\/inogicindia\/","https:\/\/www.youtube.com\/channel\/UCM4V7ousgLSu1hbOEv4DUuQ","https:\/\/www.linkedin.com\/company\/inogicindia"]},{"@type":"Person","@id":"https:\/\/www.inogic.com\/blog\/author\/sarika\/#author","url":"https:\/\/www.inogic.com\/blog\/author\/sarika\/","name":"Inogic","image":{"@type":"ImageObject","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/f7e3157d3c9d28231b0a67ff18cc6445c87e889473ae03080f7026c5482ce860?s=96&d=mm&r=g","width":96,"height":96,"caption":"Inogic"}},{"@type":"WebPage","@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#webpage","url":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/","name":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks","description":"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/#breadcrumblist"},"author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/sarika\/#author"},"creator":{"@id":"https:\/\/www.inogic.com\/blog\/author\/sarika\/#author"},"datePublished":"2023-07-11T15:28:15+05:30","dateModified":"2023-07-13T18:25:52+05:30"},{"@type":"WebSite","@id":"https:\/\/www.inogic.com\/blog\/#website","url":"https:\/\/www.inogic.com\/blog\/","name":"Microsoft Dynamics 365 CRM Tips and Tricks","alternateName":"Inogic","description":"By Inogic","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic","og:type":"article","og:title":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks","og:description":"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being","og:url":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/","og:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif","og:image:secure_url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif","og:image:width":700,"og:image:height":200,"article:published_time":"2023-07-11T09:58:15+00:00","article:modified_time":"2023-07-13T12:55:52+00:00","article:publisher":"https:\/\/www.facebook.com\/inogicindia","twitter:card":"summary_large_image","twitter:site":"@inogic","twitter:title":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically? - Microsoft Dynamics 365 CRM Tips and Tricks","twitter:description":"We were recently working on a requirement to create a polymorphic lookup attribute. We needed to use its navigation property further while working on the UI part. However, we were having issues using the navigating property of the field for some of the OOB entities. While further investigating, we found that the relationship was being","twitter:creator":"@inogic","twitter:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/07\/Increase-Productivity-by-Automating-your-daily-mundane-tasks-Get-your-custom-developments-done-by-Inogics-Certified-Experts-1.gif","twitter:label1":"Written by","twitter:data1":"Inogic","twitter:label2":"Est. reading time","twitter:data2":"2 minutes"},"aioseo_meta_data":{"post_id":"35358","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":true,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-07-11 09:47:33","updated":"2025-07-04 10:10:16","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\/category\/dynamics-365-v9-2\/\" title=\"Dynamics 365 v9\">Dynamics 365 v9<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow can I set the Navigation Property name for a Lookup Field while creating it programmatically?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.inogic.com\/blog"},{"label":"Dynamics 365 v9","link":"https:\/\/www.inogic.com\/blog\/category\/dynamics-365-v9-2\/"},{"label":"How can I set the Navigation Property name for a Lookup Field while creating it programmatically?","link":"https:\/\/www.inogic.com\/blog\/2023\/07\/how-can-i-set-the-navigation-property-name-for-a-lookup-field-while-creating-it-programmatically\/"}],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/35358","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\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=35358"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/35358\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=35358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=35358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=35358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}