<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">As you can see, that is how vtws_delete() is called. It basically marks the entity record as deleted in vtiger_crmentity table. To delete permanently you need to empty the the bin.<br />
<br />
Another way you can achieve delete is by calling the delete() method on the entity model. <br />
<br />
Since there is no official documentation you need to check the code and try to simulate it. For documents please have a look at delete() in <root>/modules/Documents/actions/Folder.php file, here vtiger uses the EntityModel for Documents and calls the delete() method on it. Depending on whether you are working with id’s or the `objects` you can choose one or the other alternative. In any case you need to empty the bin to permanently delete something. Also do have a look at Delete.php file in module/Vtiger/actions, I’m sure you’’find something useful for your case :D <br />
<br />
Buona fortuna</div>
</div>
<div name="messageReplySection">
<div dir="ltr" class="gmail_attr">Il gio 3 mar 2022, 15:15 Tiziano Morgia <<a href="mailto:tiziano.morgia@gmail.com">tiziano.morgia@gmail.com</a>> ha scritto:<br /></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>I have found this:</div>
<div>
<pre><span>include_once 'include/Webservices/Delete.php';</span><span>try {</span><span>        $wsid = vtws_getWebserviceEntityId('Leads', 'CRMID') // Module_Webservice_ID x CRM_ID</span><span>        vtws_delete($wsid, $current_user);</span><span>} catch (WebServiceException $ex) {</span><span>        echo $ex->getMessage();</span><span>}</span></pre></div>
<div>On this url => <a href="https://community.vtiger.com/help/vtigercrm/developers/server-apis.html" target="_blank" rel="noreferrer">https://community.vtiger.com/help/vtigercrm/developers/server-apis.html</a></div>
<div>Is it the right way?</div>
<div>For attachments, I imagined there was a special function because I had noticed that deleting a document from the vTiger module also removed the underlying file.</div>
<div><br /></div>
</div>
<br />
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Il giorno gio 3 mar 2022 alle ore 13:36 Sukhdev Mohan <<a href="mailto:s.mohan@myti.it" target="_blank" rel="noreferrer">s.mohan@myti.it</a>> ha scritto:<br /></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="auto">Use vtws_delete() twice to delete from db.
<div dir="auto">To physically delete the attachments just get the path and file name from db and then proceed to delete the files via script.</div>
</div>
<br />
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Il gio 3 mar 2022, 13:29 Tiziano Morgia <<a href="mailto:tiziano.morgia@gmail.com" target="_blank" rel="noreferrer">tiziano.morgia@gmail.com</a>> ha scritto:<br /></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Hi to all,</div>
   we have a vTiger instance that contains a high number of custom modules on which we import, through php scripts, a high number of data including attachments.<br />
   We therefore need to cancel the following types of data when importing data and / or through scheduled activities:<br />
<div>- Records of custom modules<br /></div>
- Attachments to the records of the previous point (including associated files on disk)<br />
- Contain the number of records of the change history (if active on the module). For example, keep the last 10 changes for each single entity.<br />
<br />
We can delete it directly using db query ($adb->query("DELETE FROM xxx");) but I think that there is a correct way, using the vtlib or similar, to delete the three types of data, or not?<br />
I tried to search but find nothing about it.<br />
Has anyone had a similar need?<br />
<br />
<div>Thanks in advance,</div>
<div>Tiziano</div>
<div><br /></div>
</div>
_______________________________________________<br />
<a href="http://www.vtiger.com/" rel="noreferrer noreferrer noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote>
</div>
_______________________________________________<br />
<a href="http://www.vtiger.com/" rel="noreferrer noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote>
</div>
<br clear="all" />
<br />
--<br />
<div dir="ltr">.::Tiziano::.<br /></div>
_______________________________________________<br />
<a href="http://www.vtiger.com/" rel="noreferrer noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote>
</div>
</body>
</html>