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

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

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 74 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans