web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

API to update business unit of Teams in dynamics 365

(0) ShareShare
ReportReport
Posted on by 65

can anyone share  API to update  Business unit of Teams 

I have the same question (0)
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at

    Hello Josh,

    Please refer below article to set the lookup value using web API.

    carldesouza.com/.../

    and to set the BU of a team u need to pass the parameter like below.

    entity["businessunitid@data.bind"]="/businessunits(give GUID of Business unit here)";

    Also if you want to set more property in the Team entity please refer below link.

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/team?view=dynamics-ce-odata-9

    Thank you,

    Amit Katariya

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Please see below code to update Business Unit of a Team from JS -

    var record = {};

    record["businessunitid@odata.bind"] = "/businessunits(80c4ecda-4c5a-ec11-8f8f-002248d4e639)";

    var req = new XMLHttpRequest();

    req.open("PATCH", Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.2/teams(74b5a34d-fb2f-ec11-b6e6-6045bda5714a)", true);

    req.setRequestHeader("OData-MaxVersion", "4.0");

    req.setRequestHeader("OData-Version", "4.0");

    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    req.setRequestHeader("Accept", "application/json");

    req.setRequestHeader("Prefer", "odata.include-annotations=*");

    req.onreadystatechange = function () {

    if (this.readyState === 4) {

    req.onreadystatechange = null;

    if (this.status === 204) {

    console.log("Record updated");

    } else {

    console.log(this.responseText);

    }

    }

    };

    req.send(JSON.stringify(record));

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Josh_1627 Profile Picture
    65 on at

    i have found this article , can anyone help me in writing api query to update team business unit .

    docs.microsoft.com/.../microsoft.crm.sdk.messages.setparentteamrequest.businessid

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    HI,

    This message request is deprecated. Consider using the UpdateRequest instead. For more information see Perform specialized operations using Update.

    docs.microsoft.com/.../microsoft.crm.sdk.messages.setparentteamrequest.businessid

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Josh_1627 Profile Picture
    65 on at

    I have tried the below but getting the error

    PATCH url/.../teams(19e4893f)

    Body

    {

    "name":"testing",

           "_businessunitId_value@odata.bind" :"1E81E2CB"

    }

    error

    "An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property '_businessunitId_value' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadUndeclaredProperty

  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You don't need _field_value. Please see below for correct syntax

    Body

    {

    "name":"testing",

    "businessunitid@odata.bind" :"/businessunits(80c4ecda-4c5a-ec11-8f8f-002248d4e639)"

    }

    where 80c4ecda-4c5a-ec11-8f8f-002248d4e639 is the BU Record GUID.

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Josh_1627 Profile Picture
    65 on at

    yes it worked :)

  • Bipin D365 Profile Picture
    28,983 Moderator on at

    Please mark my answer verified by clicking on Yes under Did this unser your question?

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at

    Hello Josh,

    Please mark my answer verified. if it helped you to resolved your issue.

    By clicking on "Yes" under "Did this answer your question?"

    Thank you,

    Amit Katariya

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans