Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to remove or delete regarding lookup using webapi javascript?

(0) ShareShare
ReportReport
Posted on by

Hello,

I want to delete the value of "Regarding Lookup" using webapi javascript while updating Task. 

var stringJSONTask = {};

objAddTask["subject"] = "test";
objAddTask["regardingobjectid_contact@odata.bind"] = "/contacts(" + null + ")";

var stringJSONTask = JSON.stringify(objAddTask);

var oDataSelect = "abc.crm.dynamics.com/.../tasks("+ taskId +")";
$.ajax({
	type: "PATCH",
	contentType: "application/json; charset=utf-8",
	datatype: "json",
	url: oDataSelect,
	data: stringJSONTask,
	async: true,
	beforeSend: function (XmlHttpRequest) {
		XmlHttpRequest.setRequestHeader("Accept", "application/json");
		XmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");
		XmlHttpRequest.setRequestHeader("Prefer", "odata.include-annotations=*");
		XmlHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
		XmlHttpRequest.setRequestHeader("OData-Version", "4.0");
	},
	success: function (data, textStatus, XmlHttpRequest) {
	  alert("updated");
	},
	error: function (xmlHttpRequest, textStatus, errorThrown) {
		alert(xmlHttpRequest.responseJSON.error.message);
	}
});


Please suggest me how to delete regarding lookup field value.

*This post is locked for comments

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: How to remove or delete regarding lookup using webapi javascript?

    Check below post:

    stackoverflow.com/.../setting-null-for-single-valued-navigation-property-using-xrm-webapi

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: How to remove or delete regarding lookup using webapi javascript?

    Have a look  below article -

    www.inogic.com/.../how-to-delete-recordfield-value-using-the-web-api-in-dynamics-crm

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: How to remove or delete regarding lookup using webapi javascript?

    Hi,

    You need to use delete requests.

    Refer these:

    community.dynamics.com/.../254377

    stackoverflow.com/.../setting-null-for-single-valued-navigation-property-using-xrm-webapi

    docs.microsoft.com/.../associate-disassociate-entities-using-web-api

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans