<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Prevent deletion of some products</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/1569/prevent-deletion-of-some-products</link><description>Hello i want to disable delete or prevent them from deleting certain products in some module when user clicks delete button. Is there any experts who knows this ? Thanks in advance any help would be appreciated. found a sample code trying to put it together</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Prevent deletion of some products</title><link>https://sugarclub.sugarcrm.com/thread/6387?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 09:49:05 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:5b8ee46b-b9f2-4d77-beab-5f6051077d41</guid><dc:creator>karl el escobar</dc:creator><description>&lt;p&gt;thanks man for taking your time to answer this post. I will try this and give any feedbacks if it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prevent deletion of some products</title><link>https://sugarclub.sugarcrm.com/thread/6386?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 09:18:15 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:e0e8e342-5b31-49ab-8da4-711829f3209b</guid><dc:creator>Hatim Alam</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://sugarclub.sugarcrm.com/members/karlel"&gt;karl el escobar&lt;/a&gt;,&lt;/p&gt;&lt;p&gt;You can use Role Management to prevent record deletions for a module by a specific group of users.&lt;/p&gt;&lt;p&gt;If you want to prevent record deletion conditionally, you can follow this article&amp;nbsp;&lt;a href="https://enricosimonetti.com/powerful-customisations-with-sugars-acl/" rel="nofollow" target="_blank"&gt;https://enricosimonetti.com/powerful-customisations-with-sugars-acl/&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;This way, &amp;quot;Delete&amp;quot; option would not be visible to users if your condition meets and you can prevent user from deleting a record from any of the platform - web, mobile, api.&lt;/p&gt;&lt;p&gt;Another simpler way is to use before_delete logic hook, check for the condition and prevent deletion by throwing sugar exception if condition meets. But in this approach, user would still see the &amp;quot;Delete&amp;quot; option but cannot delete the record and would receive a warning message (coming from sugar exception) upon delete.&lt;/p&gt;&lt;p&gt;You can check out the before_delete logic hook documentation here -&amp;nbsp;&lt;a href="https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.2/Architecture/Logic_Hooks/Module_Hooks/before_delete/" rel="nofollow" target="_blank"&gt;https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.2/Architecture/Logic_Hooks/Module_Hoo&amp;hellip;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Let us know how it goes.&lt;/p&gt;&lt;p&gt;Regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>