The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Before Delete Business Rule

Bhushan_Salseka
Mega Expert

Hi All,

I have a requirement that if user click on Delete button on shopping cart page, then it should restrict to delete and print a info message on it.

So for this i have written a Before Delete Business Rule and it is restricting user to delete catalog item. But when i am opening any catalog item page that time that BR is running and it gives an info message before added to the cart.

I did not understand which functionality is affecting.

Can anyone suggest on it.

Below is the BR i have written.

BR is on "sc_cart_item" table.

function onBefore(current, previous) {

    gs.log('Inside On After function');

  var gr = new GlideRecord('sc_cart_item');

  gr.addQuery('cat_item' , 'c89e448b4f034e004430eb1e0210c751');

  gr.query();

  while(gr.next())

  {

  current.setAbortAction(true);

  gs.addInfoMessage('Should not be Deleted');

  gs.log('inside if for deletion message');

      }

}

Thanks in Advance.

Regards

Bhushan

6 REPLIES 6

larstange
Mega Sage

Did you try the fix I have provided - we have been using this fix for several years, and it works


zica
Giga Guru

Salsekar,



You want to pup up a message when the user delet an item from the shopping cart ?



You cannot use a business rule since the record is not yet inserted into the database....