Business rule help - Stop insert on conditon

Andrew18
Giga Expert

Hi all, we have a custom table which is pulling in asset information, however we dont want IPhone records to create. I've tried the below business rule but having no joy, anyone know where I'm going wrong?

 

 

(function executeRule(current, previous /*null when async*/ ) {

    var device = current.u_device_type;

    if (device == "IPhone") {

        current.setAbort(true);
    }
})(current, previous);

 

 

5 REPLIES 5

Hi @Andrew18 

 

Glad that it's working for you, but it can't be related to current.operation() == 'insert'.

You can abort any database transaction with current.setAbortAction(true), as long as it's an Before business rule.

 

Kindly close the thread by marking the correct response as correct.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.