Trying to stop a Business Rule running on an extended table

Wayne Richmond
Tera Guru

Hey. I have a before Query Business Rule that runs on all tables extending from Task [task]. It provides Company separation for us. However, I don't want it to apply to a custom table called Order [u_order] that extends from task. Here is the rule:

find_real_file.png

find_real_file.png

The code:

function onBefore(current, previous) {
        var userCurrentCompany = gs.getUser().getCompanyID(),
	
		dotWalkPath = 'u_customer.company',
		dotWalkPathOr = '^ORu_customer.company=NULL';

        if (userCurrentCompany != '') {
            current.addEncodedQuery(dotWalkPath + "=" + userCurrentCompany + dotWalkPathOr);
        } else current.addDomainQuery("global");
}

I've tried to add a condition using the condition builder: Task type is not Order. This doesn't work. I also tried adding the following query to the end of the Condition: && sys_class_name!=u_order but this also didn't work. Any ideas?

1 ACCEPTED SOLUTION

Try this

 

gs.getSession().isInteractive() && !gs.hasRole("admin") && current.getTableName() !='u_order'

 

-Anurag

View solution in original post

12 REPLIES 12

Anurag Tripathi
Mega Patron
Mega Patron

You can add a condition 

current.sys_class_name !='u_order'

 

Please mark my answer correct/helpful if it solves your issue.
-Anurag

-Anurag

Hey Wayne,

This Worked??

-A

-Anurag

Hey, thanks for the reply, but sadly it didn't work. Just to confirm, I added it to the existing condition like so:

gs.getSession().isInteractive() && !gs.hasRole("admin") && current.sys_class_name!='u_order'

Try this

 

gs.getSession().isInteractive() && !gs.hasRole("admin") && current.getTableName() !='u_order'

 

-Anurag