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) {
window.close();
return true;
} else {
alert(OWB.Service._errorHandler(this));
return false;
}
}
}, function(error) {
alert(error.message);
return false;
});
thanks
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.