Creaet 1:N Many Record Through Javascript RRS feed

  • Question

  • Hi, I set up 1:N relationship between incident and custom entity and looking for how can I create a record for the custom entity when update the incident record. I use the following code but fail.

    var entity = new Object();
                    entity.owb_incident_owb_timespent = { IncidentId: Xrm.Page.data.entity.getId().toString().replace('{', '').replace('}', ''), LogicalName: "incident",
                        Name: Xrm.Page.getAttribute('title').getValue()
                    entity.owb_name = timespent.toString();
                    OWB.Service.CreateRecord("owb_timespent", entity, false, function(req) {        
                        if (req.readyState == 4 /* complete */) {
                            if (req.status == 200 || req.status == 201) {
                                return true;
                            } else {
                                return false;
                    }, function(error) {
                        return false;

    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, January 22, 2014 1:07 AM

All replies

  • Hi,

    What's your error?

    Please post your OWB.Service.CreateRecord helper class so that we can check it out.

    If you write the code by yourself, consider using the provided one from SDK: \sdk\samplecode\js\restendpoint\javascriptrestdataoperations\javascriptrestdataoperations\scripts\sdk.rest.js

    Hope it helps.

    Wednesday, January 22, 2014 2:20 AM