{"id":139,"date":"2023-09-05T18:46:37","date_gmt":"2023-09-05T10:46:37","guid":{"rendered":"https:\/\/just-a-web.com\/blog\/?p=139"},"modified":"2023-09-05T18:47:13","modified_gmt":"2023-09-05T10:47:13","slug":"issue-when-update-entity-reference-to-null","status":"publish","type":"post","link":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/","title":{"rendered":"Issue when Update Entity Reference To Null"},"content":{"rendered":"\n<p>We came to an issue whereby we have tester to use the D365 Web API.<\/p>\n\n\n\n<p>He is getting below error:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>{&#8220;error&#8221;:{&#8220;code&#8221;:&#8221;0x80060888&#8243;,&#8221;message&#8221;:&#8221;Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.&#8221;}}<\/p>\n<\/blockquote>\n\n\n\n<p>The issue with this error is when he try to update one of the lookup value into null using PATCH method.<\/p>\n\n\n\n<p>The request body is setting as &#8220;_prefix_fieldname_value&#8221;: null.<\/p>\n\n\n\n<p>After further checking, it is because he is missing request header &#8220;Autodisassociate&#8221; : true.<\/p>\n\n\n\n<p>By setting this in the request header, the PATCH method went through successfully with response 204.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We came to an issue whereby we have tester to use the D365 Web API. He is getting below error: {&#8220;error&#8221;:{&#8220;code&#8221;:&#8221;0x80060888&#8243;,&#8221;message&#8221;:&#8221;Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.&#8221;}} The issue with this error is when he try to update one of the lookup value into null using PATCH method.&hellip;&nbsp;<a href=\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Issue when Update Entity Reference To Null<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[1],"tags":[44,16,51],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-dynamics","tag-dynamics-365","tag-sdk","tag-web-api"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.3.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Issue when Update Entity Reference To Null - Dynamics Blog<\/title>\n<meta name=\"description\" content=\"Hitting error: Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Issue when Update Entity Reference To Null - Dynamics Blog\" \/>\n<meta property=\"og:description\" content=\"Hitting error: Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\" \/>\n<meta property=\"og:site_name\" content=\"Dynamics Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-05T10:46:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-05T10:47:13+00:00\" \/>\n<meta name=\"author\" content=\"hk.ang\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hk.ang\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\"},\"author\":{\"name\":\"hk.ang\",\"@id\":\"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af\"},\"headline\":\"Issue when Update Entity Reference To Null\",\"datePublished\":\"2023-09-05T10:46:37+00:00\",\"dateModified\":\"2023-09-05T10:47:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\"},\"wordCount\":106,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af\"},\"keywords\":[\"dynamics 365\",\"SDK\",\"web api\"],\"articleSection\":[\"Dynamics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\",\"url\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\",\"name\":\"Issue when Update Entity Reference To Null - Dynamics Blog\",\"isPartOf\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/#website\"},\"datePublished\":\"2023-09-05T10:46:37+00:00\",\"dateModified\":\"2023-09-05T10:47:13+00:00\",\"description\":\"Hitting error: Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.\",\"breadcrumb\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/just-a-web.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Issue when Update Entity Reference To Null\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/just-a-web.com\/blog\/#website\",\"url\":\"https:\/\/just-a-web.com\/blog\/\",\"name\":\"Dynamics Blog\",\"description\":\"A blog that related to coding stuff\",\"publisher\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/just-a-web.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af\",\"name\":\"hk.ang\",\"logo\":{\"@id\":\"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/just-a-web.com\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Issue when Update Entity Reference To Null - Dynamics Blog","description":"Hitting error: Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/","og_locale":"en_US","og_type":"article","og_title":"Issue when Update Entity Reference To Null - Dynamics Blog","og_description":"Hitting error: Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.","og_url":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/","og_site_name":"Dynamics Blog","article_published_time":"2023-09-05T10:46:37+00:00","article_modified_time":"2023-09-05T10:47:13+00:00","author":"hk.ang","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hk.ang","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#article","isPartOf":{"@id":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/"},"author":{"name":"hk.ang","@id":"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af"},"headline":"Issue when Update Entity Reference To Null","datePublished":"2023-09-05T10:46:37+00:00","dateModified":"2023-09-05T10:47:13+00:00","mainEntityOfPage":{"@id":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/"},"wordCount":106,"commentCount":0,"publisher":{"@id":"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af"},"keywords":["dynamics 365","SDK","web api"],"articleSection":["Dynamics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/","url":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/","name":"Issue when Update Entity Reference To Null - Dynamics Blog","isPartOf":{"@id":"https:\/\/just-a-web.com\/blog\/#website"},"datePublished":"2023-09-05T10:46:37+00:00","dateModified":"2023-09-05T10:47:13+00:00","description":"Hitting error: Property _prefix_fieldname_value cannot be updated to null. The reference property can only be deleted.","breadcrumb":{"@id":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/just-a-web.com\/blog\/2023\/09\/05\/issue-when-update-entity-reference-to-null\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/just-a-web.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Issue when Update Entity Reference To Null"}]},{"@type":"WebSite","@id":"https:\/\/just-a-web.com\/blog\/#website","url":"https:\/\/just-a-web.com\/blog\/","name":"Dynamics Blog","description":"A blog that related to coding stuff","publisher":{"@id":"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/just-a-web.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/7c5fde715b55adf97070f3506709b0af","name":"hk.ang","logo":{"@id":"https:\/\/just-a-web.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/just-a-web.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/comments?post=139"}],"version-history":[{"count":3,"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":142,"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions\/142"}],"wp:attachment":[{"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/media?parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/categories?post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/just-a-web.com\/blog\/wp-json\/wp\/v2\/tags?post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}