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

  • KlaasA Profile Picture
    5 on at
    RE: How to add new records in table teamroles using xrm webapi

    Thanks Thomas! Your code works perfect!

  • Verified answer
    Thomas David Dayman Profile Picture
    11,323 on at
    RE: How to add new records in table teamroles using xrm webapi

    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

  • Suggested answer
    Abdul Wahab Profile Picture
    12,085 Moderator on at
    RE: How to add new records in table teamroles using xrm webapi

    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/.../

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 > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 91

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans