Home Forums Development how to properly use delete?

Viewing 2 reply threads
  • Author
    Posts
    • #10563
      Jack ZhangJack Zhang
      Participant

      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
    • #10572
      Jack ZhangJack Zhang
      Participant

      <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
    • #10580
      bFanekbFanek
      Participant

      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
Viewing 2 reply threads
  • You must be logged in to reply to this topic.