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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

How to add new records in table teamroles using xrm webapi

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I'm trying to add new records in the table 'teamroles' with javascript. 

My code:

function test(){
    data = new Object();
    data.teamid = "Guid string";
    data.roleid = "Guid string";
    Xrm.WebApi.createRecord("teamroles", data).then(function (result) {
        console.log(result.id);
    });
}

I get a BadRequest (http 400) and the following Error:

The 'Create' method does not support entities of type 'systemuserroles'. MessageProcessorCache returned MessageProcessor.Empty. 

Does this mean it is not possible to create new record in de intersect table teamroles?

Or is there another way to assign a security role to a new Team?

Kind regards,

Klaas

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi KlaasA,

    This is the system table and the create operation on this table is not supported.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Verified answer
    Thomas David Dayman Profile Picture
    11,323 on at

    You could try and use the associate request instead of create?

    // NOTE: Associate Request in Xrm.WebApi supports multiple children, you can add them inside the relatedEntities array
    var associateRequest = {
    target: { entityType: "team", id: "" },
    relatedEntities: [
    { entityType: "role", id: "" }
    ],
    relationship: "teamroles_association",
    getMetadata: function () { return { boundParameter: null, parameterTypes: {}, operationType: 2, operationName: "Associate" }; }
    };

    Xrm.WebApi.online.execute(associateRequest).then(
    function success(response) {
    if (response.ok) {
    console.log("Success");
    }
    }
    ).catch(function (error) {
    console.log(error.message);
    });

    You can try and use the Dataverse REST Builder to construct the WEBApi Request

    Screenshot_5F00_33.png

  • KlaasA Profile Picture
    5 on at

    Thanks Thomas! Your code works perfect!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 128 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 95

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans