Home › Forums › Development › how to properly use delete?
- This topic has 2 replies, 2 voices, and was last updated 5 years, 7 months ago by bFanek.
-
AuthorPosts
-
-
May 15, 2019 at 3:27 pm #10563Jack ZhangParticipant
Hi,
I didn’t find enough documentation in the code, so seeking help here. I’m on node and trying to delete something:
<pre class=”lang:js decode:true”> obj.read1({
type: “Entity”,
attributes: “(lastName hsCMAXCRMId)”,
where: where
}, readRes => {
if (!readRes || !readRes.$oid) next(new Error(Nothing found on this given parameter: ${systemIDCaption}
));const draft = {
$oid: readRes.$oid,
$class: ‘Entity’,
$event: ‘delete’,
$$old: {
$oid: readRes.$oid,
$class: ‘Entity’,
$event: ‘delete’,
}
};
obj.update(draft, ‘(hsCMAXCRMId)’, true, genericResponseHandler(res, next, REQ_TYPES.OTHER, null), null, null);
});
This code reads the data correctly but does nothing for the delete event.What am I missing in there? Please help. Thanks!
0 -
May 15, 2019 at 4:16 pm #10572Jack ZhangParticipant
<pre class=”lang:js decode:true ” title=”formatted code”>obj.read1({
type: “Entity”,
attributes: “(lastName hsCMAXCRMId)”,
where: where
}, readRes => {
if (!readRes || !readRes.$oid) next(new Error(Nothing found on this given parameter: ${systemIDCaption}
));const draft = {
$oid: readRes.$oid,
$class: ‘Entity’,
$event: ‘delete’,
$$old: {
$oid: readRes.$oid,
$class: ‘Entity’,
$event: ‘delete’,
}
};
obj.update(draft, ‘(hsCMAXCRMId)’, true, genericResponseHandler(res, next, REQ_TYPES.OTHER, null), null, null);
});
0 -
May 16, 2019 at 3:33 pm #10580bFanekParticipant
Hi Jack, could you check on the jvm application logs that the delete event is passed to that object and that no exceptions are thrown? It’s possible that the model threw an error on deletion (for example if the record is read-only, or if the user does not have privileges to delete, or any other expected errors). If you’re running this against your local environment, check the console in the studio, otherwise check SystemOut if on a real environment.
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.